summaryrefslogtreecommitdiffstats
path: root/api/channel_test.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-07-27 11:30:03 -0400
committerJoramWilander <jwawilander@gmail.com>2015-08-11 12:09:54 -0400
commit1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6 (patch)
treea10ebb3fb82ad16c015276b0618c1beda18755ff /api/channel_test.go
parent4c7cdb20f074e2c06a08cd64a57060b8e8b64d2e (diff)
downloadchat-1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6.tar.gz
chat-1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6.tar.bz2
chat-1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6.zip
added getChannel api service and use that over getChannels where appropriate on client
Diffstat (limited to 'api/channel_test.go')
-rw-r--r--api/channel_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/api/channel_test.go b/api/channel_test.go
index d4fb11bd8..a0c2a6467 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -320,6 +320,27 @@ func TestGetChannel(t *testing.T) {
if _, err := Client.UpdateLastViewedAt(channel2.Id); err != nil {
t.Fatal(err)
}
+
+ if resp, err := Client.GetChannel(channel1.Id, ""); err != nil {
+ t.Fatal(err)
+ } else {
+ data := resp.Data.(*model.ChannelData)
+ if data.Channel.DisplayName != channel1.DisplayName {
+ t.Fatal("name didn't match")
+ }
+
+ // test etag caching
+ if cache_result, err := Client.GetChannel(channel1.Id, resp.Etag); err != nil {
+ t.Fatal(err)
+ } else if cache_result.Data.(*model.ChannelData) != nil {
+ t.Log(cache_result.Data)
+ t.Fatal("cache should be empty")
+ }
+ }
+
+ if _, err := Client.GetChannel("junk", ""); err == nil {
+ t.Fatal("should have failed - bad channel id")
+ }
}
func TestGetMoreChannel(t *testing.T) {