Skip to content

Commit 7e6e6ae

Browse files
committed
Test
1 parent e5a8968 commit 7e6e6ae

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/integration/api_actions_delete_run_test.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,22 @@ func TestAPIActionsDeleteRun(t *testing.T) {
2626
session := loginUser(t, user.Name)
2727
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
2828

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)
3132

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) {
3239
req := NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/repos/%s/actions/runs/795", repo.FullName())).
3340
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)
3842
}
3943

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) {
4145
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/795/artifacts", repo.FullName())).
4246
AddTokenAuth(token)
4347
resp := MakeRequest(t, req, http.StatusOK)
@@ -47,7 +51,7 @@ func testListArtifacts(t *testing.T, repo *repo_model.Repository, token string,
4751
assert.Len(t, listResp.Entries, artifacts)
4852
}
4953

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) {
5155
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/tasks", repo.FullName())).
5256
AddTokenAuth(token)
5357
resp := MakeRequest(t, req, http.StatusOK)

0 commit comments

Comments
 (0)