summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-25 09:32:42 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-25 09:32:42 -0500
commitd245b29f82a03f1aff966a2fb2100a5703d82f32 (patch)
treecf204039af74fa2579e0291e9e595f08411b0a7a /store/sql_post_store_test.go
parent8ed665cb76c0763e83a2949c4bdd70153baf72f7 (diff)
downloadchat-d245b29f82a03f1aff966a2fb2100a5703d82f32.tar.gz
chat-d245b29f82a03f1aff966a2fb2100a5703d82f32.tar.bz2
chat-d245b29f82a03f1aff966a2fb2100a5703d82f32.zip
More app code migration (#5170)
* Migrate admin functions into app package * More user function refactoring * Move post functions into app package
Diffstat (limited to 'store/sql_post_store_test.go')
-rw-r--r--store/sql_post_store_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go
index eb22979db..e3886c6bc 100644
--- a/store/sql_post_store_test.go
+++ b/store/sql_post_store_test.go
@@ -63,6 +63,29 @@ func TestPostStoreGet(t *testing.T) {
}
}
+func TestPostStoreGetSingle(t *testing.T) {
+ Setup()
+
+ o1 := &model.Post{}
+ o1.ChannelId = model.NewId()
+ o1.UserId = model.NewId()
+ o1.Message = "a" + model.NewId() + "b"
+
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
+
+ if r1 := <-store.Post().GetSingle(o1.Id); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ if r1.Data.(*model.Post).CreateAt != o1.CreateAt {
+ t.Fatal("invalid returned post")
+ }
+ }
+
+ if err := (<-store.Post().GetSingle("123")).Err; err == nil {
+ t.Fatal("Missing id should have failed")
+ }
+}
+
func TestGetEtagCache(t *testing.T) {
Setup()
o1 := &model.Post{}