diff options
author | Morlinest <Morlinest@users.noreply.github.com> | 2017-08-28 11:17:45 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-08-28 12:17:45 +0300 |
commit | 8e61823ec403b661359373f8f8b0c9a7c9ea368d (patch) | |
tree | 0ee6d56bf3f1c01348afa2a2f03dfbd6f72815de /models/user_mail_test.go | |
parent | ced50e0ec13085504fa19c82f018a2eecb70ff68 (diff) | |
download | gitea-8e61823ec403b661359373f8f8b0c9a7c9ea368d.tar.gz gitea-8e61823ec403b661359373f8f8b0c9a7c9ea368d.zip |
Fix tests code to prevent some runtime errors (#2381)
* Fix tests code to prevent some runtime errors
* Reduce nesting
Diffstat (limited to 'models/user_mail_test.go')
-rw-r--r-- | models/user_mail_test.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/models/user_mail_test.go b/models/user_mail_test.go index 4c0b6804d6..3352194e1f 100644 --- a/models/user_mail_test.go +++ b/models/user_mail_test.go @@ -14,15 +14,17 @@ func TestGetEmailAddresses(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) emails, _ := GetEmailAddresses(int64(1)) - assert.Len(t, emails, 3) - assert.False(t, emails[0].IsPrimary) - assert.True(t, emails[2].IsActivated) - assert.True(t, emails[2].IsPrimary) + if assert.Len(t, emails, 3) { + assert.False(t, emails[0].IsPrimary) + assert.True(t, emails[2].IsActivated) + assert.True(t, emails[2].IsPrimary) + } emails, _ = GetEmailAddresses(int64(2)) - assert.Len(t, emails, 2) - assert.True(t, emails[0].IsPrimary) - assert.True(t, emails[0].IsActivated) + if assert.Len(t, emails, 2) { + assert.True(t, emails[0].IsPrimary) + assert.True(t, emails[0].IsActivated) + } } func TestIsEmailUsed(t *testing.T) { |