@@ -26,18 +26,22 @@ func TestAPIActionsDeleteRun(t *testing.T) {
26
26
session := loginUser (t , user .Name )
27
27
token := getTokenForLoggedInUser (t , session , auth_model .AccessTokenScopeWriteRepository )
28
28
29
- testListArtifacts (t , repo , token , 2 )
30
- testListTasks (t , repo , token , true )
29
+ testAPIActionsDeleteRunListArtifacts (t , repo , token , 2 )
30
+ testAPIActionsDeleteRunListTasks (t , repo , token , true )
31
+ testAPIActionsDeleteRun (t , repo , token , http .StatusNoContent )
31
32
33
+ testAPIActionsDeleteRunListArtifacts (t , repo , token , 0 )
34
+ testAPIActionsDeleteRunListTasks (t , repo , token , false )
35
+ testAPIActionsDeleteRun (t , repo , token , http .StatusNotFound )
36
+ }
37
+
38
+ func testAPIActionsDeleteRun (t * testing.T , repo * repo_model.Repository , token string , expected int ) {
32
39
req := NewRequest (t , "DELETE" , fmt .Sprintf ("/api/v1/repos/%s/actions/runs/795" , repo .FullName ())).
33
40
AddTokenAuth (token )
34
- MakeRequest (t , req , http .StatusNoContent )
35
-
36
- testListArtifacts (t , repo , token , 0 )
37
- testListTasks (t , repo , token , false )
41
+ MakeRequest (t , req , expected )
38
42
}
39
43
40
- func testListArtifacts (t * testing.T , repo * repo_model.Repository , token string , artifacts int ) {
44
+ func testAPIActionsDeleteRunListArtifacts (t * testing.T , repo * repo_model.Repository , token string , artifacts int ) {
41
45
req := NewRequest (t , "GET" , fmt .Sprintf ("/api/v1/repos/%s/actions/runs/795/artifacts" , repo .FullName ())).
42
46
AddTokenAuth (token )
43
47
resp := MakeRequest (t , req , http .StatusOK )
@@ -47,7 +51,7 @@ func testListArtifacts(t *testing.T, repo *repo_model.Repository, token string,
47
51
assert .Len (t , listResp .Entries , artifacts )
48
52
}
49
53
50
- func testListTasks (t * testing.T , repo * repo_model.Repository , token string , expected bool ) {
54
+ func testAPIActionsDeleteRunListTasks (t * testing.T , repo * repo_model.Repository , token string , expected bool ) {
51
55
req := NewRequest (t , "GET" , fmt .Sprintf ("/api/v1/repos/%s/actions/tasks" , repo .FullName ())).
52
56
AddTokenAuth (token )
53
57
resp := MakeRequest (t , req , http .StatusOK )
0 commit comments