Skip to content

Commit f169f57

Browse files
committed
add test
1 parent 2b3eb5e commit f169f57

File tree

7 files changed

+31
-1
lines changed

7 files changed

+31
-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: 27 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"
@@ -70,6 +72,31 @@ func TestAPIRepoTags(t *testing.T) {
7072

7173
// check if it's gone
7274
MakeRequest(t, req, http.StatusNotFound)
75+
76+
// check action run
77+
tests := []struct {
78+
id int64
79+
event webhook.HookEventType
80+
}{
81+
{
82+
id: 793,
83+
event: webhook.HookEventCreate,
84+
},
85+
{
86+
id: 794,
87+
event: webhook.HookEventDelete,
88+
},
89+
}
90+
for _, tt := range tests {
91+
run := unittest.AssertExistsAndLoadBean(t, &actions.ActionRun{ID: tt.id})
92+
assert.NotNil(t, run)
93+
assert.Equal(t, int64(1), run.RepoID)
94+
assert.Equal(t, "test.yaml", run.WorkflowID)
95+
assert.Equal(t, newTag.Commit.SHA, run.CommitSHA)
96+
assert.Equal(t, "add workflow", run.Title)
97+
assert.Equal(t, fmt.Sprintf("refs/tags/%s", newTag.Name), run.Ref)
98+
assert.Equal(t, tt.event, run.Event)
99+
}
73100
}
74101

75102
func createNewTagUsingAPI(t *testing.T, session *TestSession, token, ownerName, repoName, name, target, msg string) *api.Tag {

0 commit comments

Comments
 (0)