summaryrefslogtreecommitdiffstats
path: root/models/admin_test.go
diff options
context:
space:
mode:
authorMorlinest <Morlinest@users.noreply.github.com>2017-08-28 11:17:45 +0200
committerLauris BH <lauris@nix.lv>2017-08-28 12:17:45 +0300
commit8e61823ec403b661359373f8f8b0c9a7c9ea368d (patch)
tree0ee6d56bf3f1c01348afa2a2f03dfbd6f72815de /models/admin_test.go
parentced50e0ec13085504fa19c82f018a2eecb70ff68 (diff)
downloadgitea-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/admin_test.go')
-rw-r--r--models/admin_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/models/admin_test.go b/models/admin_test.go
index 7fb8f1d0a0..b4383cb2d3 100644
--- a/models/admin_test.go
+++ b/models/admin_test.go
@@ -54,14 +54,16 @@ func TestNotices(t *testing.T) {
notices, err := Notices(1, 2)
assert.NoError(t, err)
- assert.Len(t, notices, 2)
- assert.Equal(t, int64(3), notices[0].ID)
- assert.Equal(t, int64(2), notices[1].ID)
+ if assert.Len(t, notices, 2) {
+ assert.Equal(t, int64(3), notices[0].ID)
+ assert.Equal(t, int64(2), notices[1].ID)
+ }
notices, err = Notices(2, 2)
assert.NoError(t, err)
- assert.Len(t, notices, 1)
- assert.Equal(t, int64(1), notices[0].ID)
+ if assert.Len(t, notices, 1) {
+ assert.Equal(t, int64(1), notices[0].ID)
+ }
}
func TestDeleteNotice(t *testing.T) {