From 0f5f85e6874b998563af47efc1d0f3be16ce567e Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 22 Apr 2021 17:13:47 +0200 Subject: [PATCH] Fix tests --- pkg/models/kanban_test.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pkg/models/kanban_test.go b/pkg/models/kanban_test.go index 99b099d4..1d41809a 100644 --- a/pkg/models/kanban_test.go +++ b/pkg/models/kanban_test.go @@ -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)