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
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
22715a31ed
Коммит
28a78d7607
@@ -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) {
|
||||
|
||||
Ссылка в новой задаче
Block a user