diff options
Diffstat (limited to 'models/token_test.go')
-rw-r--r-- | models/token_test.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/models/token_test.go b/models/token_test.go index 9674be126a..540bd40deb 100644 --- a/models/token_test.go +++ b/models/token_test.go @@ -48,17 +48,19 @@ func TestListAccessTokens(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) tokens, err := ListAccessTokens(1) assert.NoError(t, err) - assert.Len(t, tokens, 2) - assert.Equal(t, int64(1), tokens[0].UID) - assert.Equal(t, int64(1), tokens[1].UID) - assert.Contains(t, []string{tokens[0].Name, tokens[1].Name}, "Token A") - assert.Contains(t, []string{tokens[0].Name, tokens[1].Name}, "Token B") + if assert.Len(t, tokens, 2) { + assert.Equal(t, int64(1), tokens[0].UID) + assert.Equal(t, int64(1), tokens[1].UID) + assert.Contains(t, []string{tokens[0].Name, tokens[1].Name}, "Token A") + assert.Contains(t, []string{tokens[0].Name, tokens[1].Name}, "Token B") + } tokens, err = ListAccessTokens(2) assert.NoError(t, err) - assert.Len(t, tokens, 1) - assert.Equal(t, int64(2), tokens[0].UID) - assert.Equal(t, "Token A", tokens[0].Name) + if assert.Len(t, tokens, 1) { + assert.Equal(t, int64(2), tokens[0].UID) + assert.Equal(t, "Token A", tokens[0].Name) + } tokens, err = ListAccessTokens(100) assert.NoError(t, err) |