diff options
author | Teviot Systems <oss@teviot.com.au> | 2015-10-02 20:16:27 +1000 |
---|---|---|
committer | Teviot Systems <oss@teviot.com.au> | 2015-10-02 20:16:27 +1000 |
commit | fc82f57102ae4b8f89d8ad65ae3097aba9891272 (patch) | |
tree | 238630b1b6050dab81480dd7eaa03851222bfc45 /model/post_test.go | |
parent | 9083f0b15c8a2f842eb6ed54f14ecdfb4808dbe2 (diff) | |
download | chat-fc82f57102ae4b8f89d8ad65ae3097aba9891272.tar.gz chat-fc82f57102ae4b8f89d8ad65ae3097aba9891272.tar.bz2 chat-fc82f57102ae4b8f89d8ad65ae3097aba9891272.zip |
Pass-through post creation time when importing posts
Diffstat (limited to 'model/post_test.go')
-rw-r--r-- | model/post_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/model/post_test.go b/model/post_test.go index 38f4b4c98..a6b880fa0 100644 --- a/model/post_test.go +++ b/model/post_test.go @@ -83,5 +83,18 @@ func TestPostIsValid(t *testing.T) { func TestPostPreSave(t *testing.T) { o := Post{Message: "test"} o.PreSave() + + if o.CreateAt == 0 { + t.Fatal("should be set") + } + + past := GetMillis() - 1 + o = Post{Message: "test", CreateAt: past} + o.PreSave() + + if o.CreateAt > past { + t.Fatal("should not be updated") + } + o.Etag() } |