-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathchatadminrights_test.go
48 lines (41 loc) · 953 Bytes
/
chatadminrights_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package echotron
import (
"reflect"
"testing"
)
var (
rights = ChatAdministratorRights{
IsAnonymous: true,
CanManageChat: true,
CanDeleteMessages: true,
CanManageVideoChats: true,
CanRestrictMembers: true,
CanPromoteMembers: true,
CanChangeInfo: true,
CanInviteUsers: true,
CanPostStories: true,
CanEditStories: true,
CanDeleteStories: true,
}
)
func TestSetMyDefaultAdministratorRights(t *testing.T) {
_, err := api.SetMyDefaultAdministratorRights(
&SetMyDefaultAdministratorRightsOptions{
Rights: rights,
},
)
if err != nil {
t.Fatal(err)
}
}
func TestGetMyDefaultAdministratorRights(t *testing.T) {
res, err := api.GetMyDefaultAdministratorRights(nil)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(*res.Result, rights) {
t.Logf("expected: %+v", rights)
t.Logf("got: %+v", res.Result)
t.Fatal("error: chat administrator rights mismatch")
}
}