PLT-975 adding perm deletes
Этот коммит содержится в:
@@ -379,6 +379,63 @@ func TestChannelMemberStore(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestChannelDeleteMemberStore(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
c1 := model.Channel{}
|
||||
c1.TeamId = model.NewId()
|
||||
c1.DisplayName = "NameName"
|
||||
c1.Name = "a" + model.NewId() + "b"
|
||||
c1.Type = model.CHANNEL_OPEN
|
||||
c1 = *Must(store.Channel().Save(&c1)).(*model.Channel)
|
||||
|
||||
c1t1 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
|
||||
t1 := c1t1.ExtraUpdateAt
|
||||
|
||||
u1 := model.User{}
|
||||
u1.TeamId = model.NewId()
|
||||
u1.Email = model.NewId()
|
||||
u1.Nickname = model.NewId()
|
||||
Must(store.User().Save(&u1))
|
||||
|
||||
u2 := model.User{}
|
||||
u2.TeamId = model.NewId()
|
||||
u2.Email = model.NewId()
|
||||
u2.Nickname = model.NewId()
|
||||
Must(store.User().Save(&u2))
|
||||
|
||||
o1 := model.ChannelMember{}
|
||||
o1.ChannelId = c1.Id
|
||||
o1.UserId = u1.Id
|
||||
o1.NotifyProps = model.GetDefaultChannelNotifyProps()
|
||||
Must(store.Channel().SaveMember(&o1))
|
||||
|
||||
o2 := model.ChannelMember{}
|
||||
o2.ChannelId = c1.Id
|
||||
o2.UserId = u2.Id
|
||||
o2.NotifyProps = model.GetDefaultChannelNotifyProps()
|
||||
Must(store.Channel().SaveMember(&o2))
|
||||
|
||||
c1t2 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
|
||||
t2 := c1t2.ExtraUpdateAt
|
||||
|
||||
if t2 <= t1 {
|
||||
t.Fatal("Member update time incorrect")
|
||||
}
|
||||
|
||||
count := (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
|
||||
if count != 2 {
|
||||
t.Fatal("should have saved 2 members")
|
||||
}
|
||||
|
||||
Must(store.Channel().DeleteMember(o2.UserId))
|
||||
|
||||
count = (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
|
||||
if count != 1 {
|
||||
t.Fatal("should have removed 1 member")
|
||||
}
|
||||
}
|
||||
|
||||
func TestChannelStorePermissionsTo(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user