-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc.go
42 lines (38 loc) · 1.02 KB
/
doc.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
/*
Package tester implements a library that makes testing HTTP based API clients easier.
Example test:
func setup() *tester.Tester {
return tester.NewTester(map[string]tester.TestCategory{
"users": tester.TestCategory{
Scenarios: map[string]tester.TestScenario{
"create": TestScenario{
Request: TestRequest{
Method: "POST",
Path: "/user",
Headers: map[string]string{"Content-Type": "application/json"},
Body: strings.NewReader("{\"username\":\"user1\"}"),
},
Response: TestResponse{
Code: 200,
Headers: map[string]string{"Content-Type": "application/json"},
Body: strings.NewReader("{\"id\":1,\"username\":\"user1\"}"),
},
},
},
}
})
}
func TestUserCreate(t *testing.T) {
api := setup()
defer api.Close()
api.Setup(t, "user", "create")
c := NewClient(api.URL)
user, err := c.CreateUser("test")
if err != nil {
t.Fatal(err)
}
assert.Equal(t, 1, user.ID)
assert.Equal(t, "user1", user.Name)
}
*/
package tester