summaryrefslogtreecommitdiffstats
path: root/models/user_openid_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/user_openid_test.go')
-rw-r--r--models/user_openid_test.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/models/user_openid_test.go b/models/user_openid_test.go
index e4734cc428..711f92b9ff 100644
--- a/models/user_openid_test.go
+++ b/models/user_openid_test.go
@@ -14,8 +14,7 @@ func TestGetUserOpenIDs(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
oids, err := GetUserOpenIDs(int64(1))
- if assert.NoError(t, err) {
- assert.Len(t, oids, 2)
+ if assert.NoError(t, err) && assert.Len(t, oids, 2) {
assert.Equal(t, oids[0].URI, "https://user1.domain1.tld/")
assert.False(t, oids[0].Show)
assert.Equal(t, oids[1].URI, "http://user1.domain2.tld/")
@@ -23,8 +22,7 @@ func TestGetUserOpenIDs(t *testing.T) {
}
oids, err = GetUserOpenIDs(int64(2))
- if assert.NoError(t, err) {
- assert.Len(t, oids, 1)
+ if assert.NoError(t, err) && assert.Len(t, oids, 1) {
assert.Equal(t, oids[0].URI, "https://domain1.tld/user2/")
assert.True(t, oids[0].Show)
}
@@ -52,10 +50,9 @@ func TestGetUserByOpenID(t *testing.T) {
func TestToggleUserOpenIDVisibility(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
oids, err := GetUserOpenIDs(int64(2))
- if !assert.NoError(t, err) {
+ if !assert.NoError(t, err) || !assert.Len(t, oids, 1) {
return
}
- assert.Len(t, oids, 1)
assert.True(t, oids[0].Show)
err = ToggleUserOpenIDVisibility(oids[0].ID)
@@ -64,10 +61,10 @@ func TestToggleUserOpenIDVisibility(t *testing.T) {
}
oids, err = GetUserOpenIDs(int64(2))
- if assert.NoError(t, err) {
- assert.Len(t, oids, 1)
- assert.False(t, oids[0].Show)
+ if !assert.NoError(t, err) || !assert.Len(t, oids, 1) {
+ return
}
+ assert.False(t, oids[0].Show)
err = ToggleUserOpenIDVisibility(oids[0].ID)
if !assert.NoError(t, err) {
return
@@ -77,6 +74,7 @@ func TestToggleUserOpenIDVisibility(t *testing.T) {
if !assert.NoError(t, err) {
return
}
- assert.Len(t, oids, 1)
- assert.True(t, oids[0].Show)
+ if assert.Len(t, oids, 1) {
+ assert.True(t, oids[0].Show)
+ }
}