This repository was archived by the owner on Nov 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrtm_reflection_test.go
More file actions
112 lines (104 loc) · 2.78 KB
/
rtm_reflection_test.go
File metadata and controls
112 lines (104 loc) · 2.78 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package rtm
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestReflection(t *testing.T) {
t.Run("GetMethodInfo", func(t *testing.T) {
expected := &MethodInfo{
Name: "rtm.test.login",
NeedsLogin: true,
}
t.Run("Unmarshal", func(t *testing.T) {
b := readTestdataFile(t, "rtm.reflection.getMethodInfo.json")
actual, err := new(Client).Reflection().getMethodInfoUnmarshal(b)
require.NoError(t, err)
assert.Equal(t, expected, actual)
})
t.Run("Real", func(t *testing.T) {
actual, err := GetClient(t).Reflection().GetMethodInfo(Ctx, "rtm.test.login")
require.NoError(t, err)
assert.Equal(t, expected, actual)
})
})
t.Run("GetMethods", func(t *testing.T) {
expected := []string{
"rtm.auth.checkToken",
"rtm.auth.getFrob",
"rtm.auth.getToken",
"rtm.contacts.add",
"rtm.contacts.delete",
"rtm.contacts.getList",
"rtm.groups.add",
"rtm.groups.addContact",
"rtm.groups.delete",
"rtm.groups.getList",
"rtm.groups.removeContact",
"rtm.lists.add",
"rtm.lists.archive",
"rtm.lists.delete",
"rtm.lists.getList",
"rtm.lists.setDefaultList",
"rtm.lists.setName",
"rtm.lists.unarchive",
"rtm.locations.getList",
"rtm.push.getSubscriptions",
"rtm.push.getTopics",
"rtm.push.subscribe",
"rtm.push.unsubscribe",
"rtm.reflection.getMethodInfo",
"rtm.reflection.getMethods",
"rtm.scripts.add",
"rtm.scripts.delete",
"rtm.scripts.getList",
"rtm.scripts.run",
"rtm.scripts.setCode",
"rtm.scripts.setName",
"rtm.scripts.setParams",
"rtm.settings.getList",
"rtm.tags.getList",
"rtm.tasks.add",
"rtm.tasks.addTags",
"rtm.tasks.complete",
"rtm.tasks.delete",
"rtm.tasks.getList",
"rtm.tasks.movePriority",
"rtm.tasks.moveTo",
"rtm.tasks.notes.add",
"rtm.tasks.notes.delete",
"rtm.tasks.notes.edit",
"rtm.tasks.postpone",
"rtm.tasks.removeTags",
"rtm.tasks.setDueDate",
"rtm.tasks.setEstimate",
"rtm.tasks.setLocation",
"rtm.tasks.setName",
"rtm.tasks.setParentTask",
"rtm.tasks.setPriority",
"rtm.tasks.setRecurrence",
"rtm.tasks.setStartDate",
"rtm.tasks.setTags",
"rtm.tasks.setURL",
"rtm.tasks.uncomplete",
"rtm.test.echo",
"rtm.test.login",
"rtm.time.convert",
"rtm.time.parse",
"rtm.timelines.create",
"rtm.timezones.getList",
"rtm.transactions.undo",
}
t.Run("Unmarshal", func(t *testing.T) {
b := readTestdataFile(t, "rtm.reflection.getMethods.json")
actual, err := new(Client).Reflection().getMethodsUnmarshal(b)
require.NoError(t, err)
assert.Equal(t, expected, actual)
})
t.Run("Real", func(t *testing.T) {
actual, err := GetClient(t).Reflection().GetMethods(Ctx)
require.NoError(t, err)
assert.Equal(t, expected, actual)
})
})
}