Skip to content

Commit 3d469c0

Browse files
committed
update test case
1 parent 84ecf9f commit 3d469c0

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

tests/integration/api_actions_delete_run_test.go renamed to tests/integration/api_actions_run_test.go

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,61 @@ import (
1818
"github.com/stretchr/testify/assert"
1919
)
2020

21-
func TestAPIActionsDeleteRunCheckPermission(t *testing.T) {
21+
func TestAPIActionsGetWorkflowRun(t *testing.T) {
2222
defer prepareTestEnvActionsArtifacts(t)()
2323

24-
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 4})
24+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2})
2525
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
2626
session := loginUser(t, user.Name)
2727
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
28-
testAPIActionsDeleteRun(t, repo, token, http.StatusNotFound)
28+
29+
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/802802", repo.FullName())).
30+
AddTokenAuth(token)
31+
MakeRequest(t, req, http.StatusNotFound)
32+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/802", repo.FullName())).
33+
AddTokenAuth(token)
34+
MakeRequest(t, req, http.StatusNotFound)
35+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/803", repo.FullName())).
36+
AddTokenAuth(token)
37+
MakeRequest(t, req, http.StatusOK)
2938
}
3039

31-
func TestAPIActionsDeleteRun(t *testing.T) {
40+
func TestAPIActionsGetWorkflowJob(t *testing.T) {
3241
defer prepareTestEnvActionsArtifacts(t)()
3342

3443
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2})
3544
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
3645
session := loginUser(t, user.Name)
3746
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
3847

39-
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/802802", repo.FullName())).
48+
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/jobs/198198", repo.FullName())).
4049
AddTokenAuth(token)
4150
MakeRequest(t, req, http.StatusNotFound)
42-
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/802", repo.FullName())).
51+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/jobs/198", repo.FullName())).
52+
AddTokenAuth(token)
53+
MakeRequest(t, req, http.StatusOK)
54+
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/jobs/196", repo.FullName())).
4355
AddTokenAuth(token)
4456
MakeRequest(t, req, http.StatusNotFound)
57+
}
58+
59+
func TestAPIActionsDeleteRunCheckPermission(t *testing.T) {
60+
defer prepareTestEnvActionsArtifacts(t)()
61+
62+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 4})
63+
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
64+
session := loginUser(t, user.Name)
65+
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
66+
testAPIActionsDeleteRun(t, repo, token, http.StatusNotFound)
67+
}
68+
69+
func TestAPIActionsDeleteRun(t *testing.T) {
70+
defer prepareTestEnvActionsArtifacts(t)()
71+
72+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2})
73+
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
74+
session := loginUser(t, user.Name)
75+
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
4576

4677
testAPIActionsDeleteRunListArtifacts(t, repo, token, 2)
4778
testAPIActionsDeleteRunListTasks(t, repo, token, true)

0 commit comments

Comments
 (0)