diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-09-26 13:41:50 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-09-26 13:41:50 -0400 |
commit | 667db6e10c7bf4d3856a1f94eaad34d9e03352c1 (patch) | |
tree | 44fa38e30a277a11acc51453f1399aa21983e8f8 /store/sql_channel_store_test.go | |
parent | 7fcc004beb9f6ef022f755e8e2f2a958c976c637 (diff) | |
download | chat-667db6e10c7bf4d3856a1f94eaad34d9e03352c1.tar.gz chat-667db6e10c7bf4d3856a1f94eaad34d9e03352c1.tar.bz2 chat-667db6e10c7bf4d3856a1f94eaad34d9e03352c1.zip |
Cleaning up some old code from the permissions system change (#4090)
Diffstat (limited to 'store/sql_channel_store_test.go')
-rw-r--r-- | store/sql_channel_store_test.go | 91 |
1 files changed, 2 insertions, 89 deletions
diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go index 6a567f470..519fdea6a 100644 --- a/store/sql_channel_store_test.go +++ b/store/sql_channel_store_test.go @@ -4,9 +4,10 @@ package store import ( - "github.com/mattermost/platform/model" "testing" "time" + + "github.com/mattermost/platform/model" ) func TestChannelStoreSave(t *testing.T) { @@ -442,94 +443,6 @@ func TestChannelDeleteMemberStore(t *testing.T) { } } -func TestChannelStorePermissionsTo(t *testing.T) { - Setup() - - o1 := model.Channel{} - o1.TeamId = model.NewId() - o1.DisplayName = "Channel1" - o1.Name = "a" + model.NewId() + "b" - o1.Type = model.CHANNEL_OPEN - Must(store.Channel().Save(&o1)) - - m1 := model.ChannelMember{} - m1.ChannelId = o1.Id - m1.UserId = model.NewId() - m1.NotifyProps = model.GetDefaultChannelNotifyProps() - Must(store.Channel().SaveMember(&m1)) - - count := (<-store.Channel().CheckPermissionsTo(o1.TeamId, o1.Id, m1.UserId)).Data.(int64) - if count != 1 { - t.Fatal("should have permissions") - } - - count = (<-store.Channel().CheckPermissionsToNoTeam(o1.Id, m1.UserId)).Data.(int64) - if count != 1 { - t.Fatal("should have permissions") - } - - count = (<-store.Channel().CheckPermissionsTo("junk", o1.Id, m1.UserId)).Data.(int64) - if count != 0 { - t.Fatal("shouldn't have permissions") - } - - count = (<-store.Channel().CheckPermissionsTo(o1.TeamId, "junk", m1.UserId)).Data.(int64) - if count != 0 { - t.Fatal("shouldn't have permissions") - } - - count = (<-store.Channel().CheckPermissionsToNoTeam("junk", m1.UserId)).Data.(int64) - if count != 0 { - t.Fatal("shouldn't have permissions") - } - - count = (<-store.Channel().CheckPermissionsTo(o1.TeamId, o1.Id, "junk")).Data.(int64) - if count != 0 { - t.Fatal("shouldn't have permissions") - } - - count = (<-store.Channel().CheckPermissionsToNoTeam(o1.Id, "junk")).Data.(int64) - if count != 0 { - t.Fatal("shouldn't have permissions") - } - - channelId := (<-store.Channel().CheckPermissionsToByName(o1.TeamId, o1.Name, m1.UserId)).Data.(string) - if channelId != o1.Id { - t.Fatal("should have permissions") - } - - channelId = (<-store.Channel().CheckPermissionsToByName(o1.TeamId, "missing", m1.UserId)).Data.(string) - if channelId != "" { - t.Fatal("should not have permissions") - } -} - -func TestChannelStoreOpenChannelPermissionsTo(t *testing.T) { - Setup() - - o1 := model.Channel{} - o1.TeamId = model.NewId() - o1.DisplayName = "Channel1" - o1.Name = "a" + model.NewId() + "b" - o1.Type = model.CHANNEL_OPEN - Must(store.Channel().Save(&o1)) - - count := (<-store.Channel().CheckOpenChannelPermissions(o1.TeamId, o1.Id)).Data.(int64) - if count != 1 { - t.Fatal("should have permissions") - } - - count = (<-store.Channel().CheckOpenChannelPermissions("junk", o1.Id)).Data.(int64) - if count != 0 { - t.Fatal("shouldn't have permissions") - } - - count = (<-store.Channel().CheckOpenChannelPermissions(o1.TeamId, "junk")).Data.(int64) - if count != 0 { - t.Fatal("shouldn't have permissions") - } -} - func TestChannelStoreGetChannels(t *testing.T) { Setup() |