Fix tests

This commit is contained in:
kolaente 2021-04-22 17:13:47 +02:00
parent 4ceeb877b1
commit 0f5f85e687
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 20 additions and 2 deletions

View File

@ -89,12 +89,30 @@ func TestBucket_ReadAll(t *testing.T) {
assert.Len(t, buckets, 3)
assert.Equal(t, int64(2), buckets[0].Tasks[0].ID)
})
t.Run("link share", func(t *testing.T) {
t.Run("accessed by link share", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
testuser := &user.User{ID: 1}
linkShare := &LinkSharing{
ID: 1,
ListID: 1,
Right: RightRead,
}
b := &Bucket{ListID: 1}
result, _, _, err := b.ReadAll(s, linkShare, "", 0, 0)
assert.NoError(t, err)
buckets, _ := result.([]*Bucket)
assert.Len(t, buckets, 3)
assert.NotNil(t, buckets[0].CreatedBy)
assert.Equal(t, int64(1), buckets[0].CreatedByID)
})
t.Run("created by link share", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
testuser := &user.User{ID: 12}
b := &Bucket{ListID: 23}
result, _, _, err := b.ReadAll(s, testuser, "", 0, 0)
assert.NoError(t, err)