summaryrefslogtreecommitdiffstats
path: root/store/sql_channel_store_test.go
diff options
context:
space:
mode:
authorRobin Naundorf <r.naundorf@fh-muenster.de>2017-05-15 22:12:30 +0200
committerJoram Wilander <jwawilander@gmail.com>2017-05-15 16:12:30 -0400
commit0a20e8d3269515e2d44a0bcad0a2408f62245814 (patch)
tree533767c6a60939504f8f70c60bd4ff77ef0e8fe7 /store/sql_channel_store_test.go
parent34728f748bfd7976c085f1be77e53f70d6e55a06 (diff)
downloadchat-0a20e8d3269515e2d44a0bcad0a2408f62245814.tar.gz
chat-0a20e8d3269515e2d44a0bcad0a2408f62245814.tar.bz2
chat-0a20e8d3269515e2d44a0bcad0a2408f62245814.zip
PLT-6019: Add APIv4 Endpoint for restoring Channels (#6263)
Diffstat (limited to 'store/sql_channel_store_test.go')
-rw-r--r--store/sql_channel_store_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go
index 55a263037..fc98f3f4e 100644
--- a/store/sql_channel_store_test.go
+++ b/store/sql_channel_store_test.go
@@ -364,6 +364,34 @@ func TestChannelStoreGetForPost(t *testing.T) {
}
}
+func TestSqlChannelStoreRestore(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))
+
+ if r := <-store.Channel().Delete(o1.Id, model.GetMillis()); r.Err != nil {
+ t.Fatal(r.Err)
+ }
+
+ if r := <-store.Channel().Get(o1.Id, false); r.Data.(*model.Channel).DeleteAt == 0 {
+ t.Fatal("should have been deleted")
+ }
+
+ if r := <-store.Channel().Restore(o1.Id, model.GetMillis()); r.Err != nil {
+ t.Fatal(r.Err)
+ }
+
+ if r := <-store.Channel().Get(o1.Id, false); r.Data.(*model.Channel).DeleteAt != 0 {
+ t.Fatal("should have been restored")
+ }
+
+}
+
func TestChannelStoreDelete(t *testing.T) {
Setup()