summaryrefslogtreecommitdiffstats
path: root/models/token_test.go
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2019-05-04 11:45:34 -0400
committerGitHub <noreply@github.com>2019-05-04 11:45:34 -0400
commit46373e765702a203bfcb576c9d3639314ef4965f (patch)
treea44ba4de8593a9ad7898683e0e6df80e0072ef17 /models/token_test.go
parent1fa96629461ac4229932b0a4526fc2f60c88ec51 (diff)
downloadgitea-46373e765702a203bfcb576c9d3639314ef4965f.tar.gz
gitea-46373e765702a203bfcb576c9d3639314ef4965f.zip
Hash App token (#6724)
Diffstat (limited to 'models/token_test.go')
-rw-r--r--models/token_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/models/token_test.go b/models/token_test.go
index 540bd40deb..9f2699a168 100644
--- a/models/token_test.go
+++ b/models/token_test.go
@@ -29,11 +29,12 @@ func TestNewAccessToken(t *testing.T) {
func TestGetAccessTokenBySHA(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
- token, err := GetAccessTokenBySHA("hash1")
+ token, err := GetAccessTokenBySHA("d2c6c1ba3890b309189a8e618c72a162e4efbf36")
assert.NoError(t, err)
assert.Equal(t, int64(1), token.UID)
assert.Equal(t, "Token A", token.Name)
- assert.Equal(t, "hash1", token.Sha1)
+ assert.Equal(t, "2b3668e11cb82d3af8c6e4524fc7841297668f5008d1626f0ad3417e9fa39af84c268248b78c481daa7e5dc437784003494f", token.TokenHash)
+ assert.Equal(t, "e4efbf36", token.TokenLastEight)
token, err = GetAccessTokenBySHA("notahash")
assert.Error(t, err)
@@ -69,7 +70,7 @@ func TestListAccessTokens(t *testing.T) {
func TestUpdateAccessToken(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
- token, err := GetAccessTokenBySHA("hash2")
+ token, err := GetAccessTokenBySHA("4c6f36e6cf498e2a448662f915d932c09c5a146c")
assert.NoError(t, err)
token.Name = "Token Z"
@@ -80,7 +81,7 @@ func TestUpdateAccessToken(t *testing.T) {
func TestDeleteAccessTokenByID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
- token, err := GetAccessTokenBySHA("hash2")
+ token, err := GetAccessTokenBySHA("4c6f36e6cf498e2a448662f915d932c09c5a146c")
assert.NoError(t, err)
assert.Equal(t, int64(1), token.UID)