This commit is contained in:
kolaente 2018-07-27 19:28:12 +02:00
parent 261136c2bc
commit 5db306bacc
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -1,8 +1,8 @@
package models
import (
"testing"
"github.com/stretchr/testify/assert"
"testing"
)
func TestTeamMember_Create(t *testing.T) {
@ -23,7 +23,7 @@ func TestTeamMember_Create(t *testing.T) {
assert.NoError(t, err)
// Check he's in there
team := Team{ID:1}
team := Team{ID: 1}
err = team.ReadOne()
assert.NoError(t, err)
assert.Equal(t, 3, len(team.Members))
@ -39,12 +39,12 @@ func TestTeamMember_Create(t *testing.T) {
assert.NoError(t, err)
// Delete the other one
tm := TeamMember{TeamID:1, UserID:2}
tm := TeamMember{TeamID: 1, UserID: 2}
err = tm.Delete()
assert.NoError(t, err)
// Try deleting the last one
tm = TeamMember{TeamID:1, UserID:1}
tm = TeamMember{TeamID: 1, UserID: 1}
err = tm.Delete()
assert.Error(t, err)
assert.True(t, IsErrCannotDeleteLastTeamMember(err))
@ -56,7 +56,7 @@ func TestTeamMember_Create(t *testing.T) {
assert.True(t, IsErrUserDoesNotExist(err))
// Try adding a user to a team which does not exist
tm = TeamMember{TeamID:94824, UserID:1}
tm = TeamMember{TeamID: 94824, UserID: 1}
err = tm.Create(&doer)
assert.Error(t, err)
assert.True(t, IsErrTeamDoesNotExist(err))