Fixed tests failing

This commit is contained in:
kolaente 2018-10-06 22:26:17 +02:00
parent f4ac036f27
commit 224cebfd10
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 3 additions and 3 deletions

View file

@ -78,7 +78,7 @@ func (l *List) checkListTeamRight(user *User, r TeamRight) bool {
Join("LEFT", []string{"team_members", "tm"}, "tm.team_id = tn.team_id"). Join("LEFT", []string{"team_members", "tm"}, "tm.team_id = tn.team_id").
Join("LEFT", []string{"team_list", "tl"}, "l.id = tl.list_id"). Join("LEFT", []string{"team_list", "tl"}, "l.id = tl.list_id").
Join("LEFT", []string{"team_members", "tm2"}, "tm2.team_id = tl.team_id"). Join("LEFT", []string{"team_members", "tm2"}, "tm2.team_id = tl.team_id").
Where("((tm.user_id = ? AND tn.right = ?) OR (tm2.user_id = ? AND tl.rights = ?)) AND l.id = ?", Where("((tm.user_id = ? AND tn.right = ?) OR (tm2.user_id = ? AND tl.right = ?)) AND l.id = ?",
user.ID, r, user.ID, r, l.ID). user.ID, r, user.ID, r, l.ID).
Exist(&List{}) Exist(&List{})
if err != nil { if err != nil {

View file

@ -80,7 +80,7 @@ func (n *Namespace) checkTeamRights(user *User, r TeamRight) bool {
Join("LEFT", "team_namespaces", "namespaces.id = team_namespaces.namespace_id"). Join("LEFT", "team_namespaces", "namespaces.id = team_namespaces.namespace_id").
Join("LEFT", "team_members", "team_members.team_id = team_namespaces.team_id"). Join("LEFT", "team_members", "team_members.team_id = team_namespaces.team_id").
Where("namespaces.id = ? "+ Where("namespaces.id = ? "+
"AND ((team_members.user_id = ? AND team_namespaces.right = ?) "+ "AND (team_members.user_id = ? AND team_namespaces.right = ?) "+
"OR namespaces.owner_id = ? ", n.ID, user.ID, r, user.ID). "OR namespaces.owner_id = ? ", n.ID, user.ID, r, user.ID).
Get(&Namespace{}) Get(&Namespace{})
if err != nil { if err != nil {

View file

@ -52,7 +52,7 @@ func TestNamespace_Create(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
// Try updating one with a nonexistant owner // Try updating one with a nonexistant owner
dummynamespace.OwnerID = 94829838572 dummynamespace.Owner.ID = 94829838572
err = dummynamespace.Update() err = dummynamespace.Update()
assert.Error(t, err) assert.Error(t, err)
assert.True(t, IsErrUserDoesNotExist(err)) assert.True(t, IsErrUserDoesNotExist(err))