From 7d8e3f1bae372ee9f871906b24f875f9e8bc887e Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 13 Sep 2018 19:24:40 +0200 Subject: [PATCH] Updated tests --- models/fixtures/list.yml | 8 +++++++- models/fixtures/namespaces.yml | 7 ++++++- models/team_list_test.go | 10 +++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/models/fixtures/list.yml b/models/fixtures/list.yml index b2bd0b83bd8..c151e2fc18c 100644 --- a/models/fixtures/list.yml +++ b/models/fixtures/list.yml @@ -9,4 +9,10 @@ title: Test2 description: Lorem Ipsum owner_id: 3 - namespace_id: 1 \ No newline at end of file + namespace_id: 1 +- + id: 3 + title: Test3 + description: Lorem Ipsum + owner_id: 3 + namespace_id: 2 \ No newline at end of file diff --git a/models/fixtures/namespaces.yml b/models/fixtures/namespaces.yml index 4ae3ad8b08e..12c19130651 100644 --- a/models/fixtures/namespaces.yml +++ b/models/fixtures/namespaces.yml @@ -2,4 +2,9 @@ id: 1 name: testnamespace description: Lorem Ipsum - owner_id: 1 \ No newline at end of file + owner_id: 1 +- + id: 2 + name: testnamespace2 + description: Lorem Ipsum + owner_id: 2 \ No newline at end of file diff --git a/models/team_list_test.go b/models/team_list_test.go index 95fafbf146d..faaecfd74b2 100644 --- a/models/team_list_test.go +++ b/models/team_list_test.go @@ -4,6 +4,7 @@ import ( "github.com/stretchr/testify/assert" "reflect" "testing" + "fmt" ) func TestTeamList(t *testing.T) { @@ -61,10 +62,17 @@ func TestTeamList(t *testing.T) { assert.Error(t, err) assert.True(t, IsErrListDoesNotExist(err)) - // Test Read all for a list where the user does not have access + // Test Read all for a list where the user is owner of the namespace this list belongs to tl5 := tl tl5.ListID = 2 _, err = tl5.ReadAll(&user) + assert.NoError(t, err) + + // Test read all for a list where the user not has access + tl6 := tl + tl6.ListID = 3 + _, err = tl6.ReadAll(&user) + fmt.Println(tl6) assert.Error(t, err) assert.True(t, IsErrNeedToHaveListReadAccess(err))