Skip to content

Commit 7326614

Browse files
committed
add test
1 parent 2b3eb5e commit 7326614

File tree

7 files changed

+26
-1
lines changed

7 files changed

+26
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
x��K
2+
1]�� ҝN��*�tPt������eQ/�y�wm�}�9 �̄�C��x��P�"{7%VK��յwS5�2��P���gxr�Gm���lQ��omӟ��a�𺮧��FF 4��0�ߺ�W�X�����϶�/T�<�
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x�1� PgN�0K��\�861����򝚦�!��yZ����V1%{���.q0Q�s�P��O4�����в4����u����Z�JƳ�*���$
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
65f1bf27bc3bf70f64657658635e66094edbcb4d
1+
94dc45d6ec51090b36c4d5bd5d9e6f5a70da9edf

tests/integration/api_repo_tags_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import (
88
"net/http"
99
"testing"
1010

11+
"code.gitea.io/gitea/models/actions"
1112
auth_model "code.gitea.io/gitea/models/auth"
1213
"code.gitea.io/gitea/models/unittest"
1314
user_model "code.gitea.io/gitea/models/user"
1415
"code.gitea.io/gitea/modules/setting"
1516
api "code.gitea.io/gitea/modules/structs"
17+
"code.gitea.io/gitea/modules/webhook"
1618
"code.gitea.io/gitea/tests"
1719

1820
"github.com/stretchr/testify/assert"
@@ -63,11 +65,31 @@ func TestAPIRepoTags(t *testing.T) {
6365
DecodeJSON(t, resp, &tag)
6466
assert.EqualValues(t, newTag, tag)
6567

68+
// check action run
69+
run := unittest.AssertExistsAndLoadBean(t, &actions.ActionRun{RepoID: 793})
70+
assert.NotNil(t, run)
71+
assert.Equal(t, 1, run.RepoID)
72+
assert.Equal(t, "test.yaml", run.WorkflowID)
73+
assert.Equal(t, newTag.Commit.SHA, run.CommitSHA)
74+
assert.Equal(t, "add workflow", run.Title)
75+
assert.Equal(t, fmt.Sprintf("refs/tags/%s", newTag.Name), run.Ref)
76+
assert.Equal(t, webhook.HookEventCreate, run.Event)
77+
6678
// delete tag
6779
delReq := NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/tags/%s", user.Name, repoName, newTag.Name).
6880
AddTokenAuth(token)
6981
MakeRequest(t, delReq, http.StatusNoContent)
7082

83+
// check action run
84+
run = unittest.AssertExistsAndLoadBean(t, &actions.ActionRun{RepoID: 794})
85+
assert.NotNil(t, run)
86+
assert.Equal(t, 1, run.RepoID)
87+
assert.Equal(t, "test.yaml", run.WorkflowID)
88+
assert.Equal(t, newTag.Commit.SHA, run.CommitSHA)
89+
assert.Equal(t, "add workflow", run.Title)
90+
assert.Equal(t, fmt.Sprintf("refs/tags/%s", newTag.Name), run.Ref)
91+
assert.Equal(t, webhook.HookEventDelete, run.Event)
92+
7193
// check if it's gone
7294
MakeRequest(t, req, http.StatusNotFound)
7395
}

0 commit comments

Comments
 (0)