From 1c0ee4d2f65d1d4434a3a16070abe7d61a268ce6 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 27 Jul 2015 11:30:03 -0400 Subject: added getChannel api service and use that over getChannels where appropriate on client --- api/channel_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'api/channel_test.go') 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) { -- cgit v1.2.3-1-g7c22