From 9f3b25c3589ac2408d064a3e7ec76cf14f620a46 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 1 Nov 2019 05:48:31 +0100 Subject: [PATCH] fix test + add new case --- models/fixtures/issue_watch.yml | 16 ++++++++++++++++ models/issue_watch_test.go | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/models/fixtures/issue_watch.yml b/models/fixtures/issue_watch.yml index 75351eb17f88..773e1cfb3d53 100644 --- a/models/fixtures/issue_watch.yml +++ b/models/fixtures/issue_watch.yml @@ -13,3 +13,19 @@ is_watching: false created_unix: 946684800 updated_unix: 946684800 + +- + id: 3 + user_id: 2 + issue_id: 3 + is_watching: true + created_unix: 946684800 + updated_unix: 946684800 + +- + id: 3 + user_id: 1 + issue_id: 3 + is_watching: false + created_unix: 946684800 + updated_unix: 946684800 diff --git a/models/issue_watch_test.go b/models/issue_watch_test.go index ce0d2045ca68..52e989ef39cf 100644 --- a/models/issue_watch_test.go +++ b/models/issue_watch_test.go @@ -48,6 +48,12 @@ func TestGetIssueWatchers(t *testing.T) { iws, err = GetIssueWatchers(2) assert.NoError(t, err) + // Watcher is not watching + assert.Equal(t, 0, len(iws)) + + iws, err = GetIssueWatchers(3) + assert.NoError(t, err) + // Watcher is not watching assert.Equal(t, 1, len(iws)) iws, err = GetIssueWatchers(5)