summaryrefslogtreecommitdiffstats
path: root/model/channel_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-24 16:45:34 -0400
committerCorey Hulen <corey@hulen.com>2017-03-24 13:45:34 -0700
commit28a78d76074749a3b7f1ef2a56617b0a1c7fd623 (patch)
tree4adc9c167991a9cea04fa9cc3c01e247a50293c8 /model/channel_test.go
parent22715a31ed6238eb4f8f0dd8125bf23958345e78 (diff)
downloadchat-28a78d76074749a3b7f1ef2a56617b0a1c7fd623.tar.gz
chat-28a78d76074749a3b7f1ef2a56617b0a1c7fd623.tar.bz2
chat-28a78d76074749a3b7f1ef2a56617b0a1c7fd623.zip
Implement some channel endpoints for APIv4 (#5846)
* Add v4 endpoint for getting the channels on a team for a user * Implement PUT /channels/{channel_id}/patch endpoint for APIv4 * Implement POST /teams/{team_id}/channels/search endpoint for APIv4 * Update permission check
Diffstat (limited to 'model/channel_test.go')
-rw-r--r--model/channel_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/model/channel_test.go b/model/channel_test.go
index deb36633c..207ce4639 100644
--- a/model/channel_test.go
+++ b/model/channel_test.go
@@ -16,6 +16,39 @@ func TestChannelJson(t *testing.T) {
if o.Id != ro.Id {
t.Fatal("Ids do not match")
}
+
+ p := ChannelPatch{Name: new(string)}
+ *p.Name = NewId()
+ json = p.ToJson()
+ rp := ChannelPatchFromJson(strings.NewReader(json))
+
+ if *p.Name != *rp.Name {
+ t.Fatal("names do not match")
+ }
+}
+
+func TestChannelPatch(t *testing.T) {
+ p := &ChannelPatch{Name: new(string), DisplayName: new(string), Header: new(string), Purpose: new(string)}
+ *p.Name = NewId()
+ *p.DisplayName = NewId()
+ *p.Header = NewId()
+ *p.Purpose = NewId()
+
+ o := Channel{Id: NewId(), Name: NewId()}
+ o.Patch(p)
+
+ if *p.Name != o.Name {
+ t.Fatal("do not match")
+ }
+ if *p.DisplayName != o.DisplayName {
+ t.Fatal("do not match")
+ }
+ if *p.Header != o.Header {
+ t.Fatal("do not match")
+ }
+ if *p.Purpose != o.Purpose {
+ t.Fatal("do not match")
+ }
}
func TestChannelIsValid(t *testing.T) {