Fix tests
This commit is contained in:
parent
4ceeb877b1
commit
0f5f85e687
1 changed files with 20 additions and 2 deletions
|
@ -89,12 +89,30 @@ func TestBucket_ReadAll(t *testing.T) {
|
||||||
assert.Len(t, buckets, 3)
|
assert.Len(t, buckets, 3)
|
||||||
assert.Equal(t, int64(2), buckets[0].Tasks[0].ID)
|
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)
|
db.LoadAndAssertFixtures(t)
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
defer s.Close()
|
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}
|
b := &Bucket{ListID: 23}
|
||||||
result, _, _, err := b.ReadAll(s, testuser, "", 0, 0)
|
result, _, _, err := b.ReadAll(s, testuser, "", 0, 0)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
Loading…
Reference in a new issue