Skip to content

Commit 90a31b0

Browse files
committed
check token in test
1 parent 1df6c57 commit 90a31b0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/integration/actions_settings_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ import (
1010
"strconv"
1111
"testing"
1212

13+
actions_model "code.gitea.io/gitea/models/actions"
1314
auth_model "code.gitea.io/gitea/models/auth"
1415
"code.gitea.io/gitea/models/unittest"
1516
user_model "code.gitea.io/gitea/models/user"
17+
18+
"github.com/stretchr/testify/assert"
1619
)
1720

1821
func TestActionsCollaborativeOwner(t *testing.T) {
@@ -26,7 +29,10 @@ func TestActionsCollaborativeOwner(t *testing.T) {
2629
// a private repo(id=6) of user10 will try to clone "reusable_workflow" repo
2730
user10 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 10})
2831
// task id is 55 and its repo_id=6
32+
task := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionTask{ID: 55, RepoID: 6})
2933
taskToken := "674f727a81ed2f195bccab036cccf86a182199eb"
34+
tokenHash := auth_model.HashToken(taskToken, task.TokenSalt)
35+
assert.Equal(t, task.TokenHash, tokenHash)
3036

3137
dstPath := t.TempDir()
3238
u.Path = fmt.Sprintf("%s/%s.git", repo.Owner.UserName, repo.Name)

0 commit comments

Comments
 (0)