Fix tests

This commit is contained in:
kolaente 2021-04-22 17:13:47 +02:00
parent 4ceeb877b1
commit 0f5f85e687
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

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)