diff options
Diffstat (limited to 'store/storetest/role_store.go')
-rw-r--r-- | store/storetest/role_store.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/store/storetest/role_store.go b/store/storetest/role_store.go index 499e36e1e..e51c32622 100644 --- a/store/storetest/role_store.go +++ b/store/storetest/role_store.go @@ -17,6 +17,7 @@ func TestRoleStore(t *testing.T, ss store.Store) { t.Run("Get", func(t *testing.T) { testRoleStoreGet(t, ss) }) t.Run("GetByName", func(t *testing.T) { testRoleStoreGetByName(t, ss) }) t.Run("GetNames", func(t *testing.T) { testRoleStoreGetByNames(t, ss) }) + t.Run("PermanentDeleteAll", func(t *testing.T) { testRoleStorePermanentDeleteAll(t, ss) }) } func testRoleStoreSave(t *testing.T, ss store.Store) { @@ -242,3 +243,42 @@ func testRoleStoreGetByNames(t *testing.T, ss store.Store) { assert.NotContains(t, roles6, d2) assert.NotContains(t, roles6, d3) } + +func testRoleStorePermanentDeleteAll(t *testing.T, ss store.Store) { + r1 := &model.Role{ + Name: model.NewId(), + DisplayName: model.NewId(), + Description: model.NewId(), + Permissions: []string{ + "invite_user", + "create_public_channel", + "add_user_to_team", + }, + SchemeManaged: false, + } + r2 := &model.Role{ + Name: model.NewId(), + DisplayName: model.NewId(), + Description: model.NewId(), + Permissions: []string{ + "read_channel", + "create_public_channel", + "add_user_to_team", + }, + SchemeManaged: false, + } + + store.Must(ss.Role().Save(r1)) + store.Must(ss.Role().Save(r2)) + + res1 := <-ss.Role().GetByNames([]string{r1.Name, r2.Name}) + assert.Nil(t, res1.Err) + assert.Len(t, res1.Data.([]*model.Role), 2) + + res2 := <-ss.Role().PermanentDeleteAll() + assert.Nil(t, res2.Err) + + res3 := <-ss.Role().GetByNames([]string{r1.Name, r2.Name}) + assert.Nil(t, res3.Err) + assert.Len(t, res3.Data.([]*model.Role), 0) +} |