diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-12-20 23:43:26 -0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-12-21 09:43:26 +0200 |
commit | 515cdaa85d6087d91a61ebe74fae39e0c4bdf1c4 (patch) | |
tree | 3a7143fc376af4402ca9008876be3afdc0c18efc /models/org_team_test.go | |
parent | 529482135c8e9304dd7cdf08772eaba61d903894 (diff) | |
download | gitea-515cdaa85d6087d91a61ebe74fae39e0c4bdf1c4.tar.gz gitea-515cdaa85d6087d91a61ebe74fae39e0c4bdf1c4.zip |
Fix ignored errors when checking if organization, team member (#3177)
Diffstat (limited to 'models/org_team_test.go')
-rw-r--r-- | models/org_team_test.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/models/org_team_test.go b/models/org_team_test.go index 9afd733d81..05429c7cc2 100644 --- a/models/org_team_test.go +++ b/models/org_team_test.go @@ -250,16 +250,21 @@ func TestDeleteTeam(t *testing.T) { func TestIsTeamMember(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) + test := func(orgID, teamID, userID int64, expected bool) { + isMember, err := IsTeamMember(orgID, teamID, userID) + assert.NoError(t, err) + assert.Equal(t, expected, isMember) + } - assert.True(t, IsTeamMember(3, 1, 2)) - assert.False(t, IsTeamMember(3, 1, 4)) - assert.False(t, IsTeamMember(3, 1, NonexistentID)) + test(3, 1, 2, true) + test(3, 1, 4, false) + test(3, 1, NonexistentID, false) - assert.True(t, IsTeamMember(3, 2, 2)) - assert.True(t, IsTeamMember(3, 2, 4)) + test(3, 2, 2, true) + test(3, 2, 4, true) - assert.False(t, IsTeamMember(3, NonexistentID, NonexistentID)) - assert.False(t, IsTeamMember(NonexistentID, NonexistentID, NonexistentID)) + test(3, NonexistentID, NonexistentID, false) + test(NonexistentID, NonexistentID, NonexistentID, false) } func TestGetTeamMembers(t *testing.T) { |