summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-02-02 11:46:42 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-02-02 11:46:42 -0500
commit365514174ef00dcf426b2b5704c3d7adebe926e1 (patch)
tree41f5544aed1b822ae4e476c9ede496ce740d5048 /store/sql_post_store_test.go
parent60be5c902fe30c978d5b30f265509dc28c451407 (diff)
downloadchat-365514174ef00dcf426b2b5704c3d7adebe926e1.tar.gz
chat-365514174ef00dcf426b2b5704c3d7adebe926e1.tar.bz2
chat-365514174ef00dcf426b2b5704c3d7adebe926e1.zip
Add tear down to APIv4 tests (#5250)
* Add tear down to APIv4 tests * Defer tear downs
Diffstat (limited to 'store/sql_post_store_test.go')
-rw-r--r--store/sql_post_store_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go
index 7416e0ab7..626894a2a 100644
--- a/store/sql_post_store_test.go
+++ b/store/sql_post_store_test.go
@@ -352,6 +352,12 @@ func TestPostStorePermDelete1Level(t *testing.T) {
o2.RootId = o1.Id
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
+ o3 := &model.Post{}
+ o3.ChannelId = model.NewId()
+ o3.UserId = model.NewId()
+ o3.Message = "a" + model.NewId() + "b"
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
+
if r2 := <-store.Post().PermanentDeleteByUser(o2.UserId); r2.Err != nil {
t.Fatal(r2.Err)
}
@@ -363,6 +369,14 @@ func TestPostStorePermDelete1Level(t *testing.T) {
if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil {
t.Fatal("Deleted id should have failed")
}
+
+ if r2 := <-store.Post().PermanentDeleteByChannel(o3.ChannelId); r2.Err != nil {
+ t.Fatal(r2.Err)
+ }
+
+ if r3 := (<-store.Post().Get(o3.Id)); r3.Err == nil {
+ t.Fatal("Deleted id should have failed")
+ }
}
func TestPostStorePermDelete1Level2(t *testing.T) {