forked from masci/flickr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flickr_test.go
38 lines (29 loc) · 860 Bytes
/
flickr_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
package flickr
import (
"bytes"
"testing"
)
func TestDoGet(t *testing.T) {
bodyStr := `<?xml version="1.0" encoding="utf-8" ?><rsp stat="ok"></rsp>`
fclient := GetTestClient()
server, client := FlickrMock(200, bodyStr, "")
defer server.Close()
fclient.HTTPClient = client
err := DoGet(fclient, &FooResponse{})
Expect(t, err, nil)
}
func TestDoPostBody(t *testing.T) {
bodyStr := `<?xml version="1.0" encoding="utf-8" ?><rsp stat="ok"></rsp>`
fclient := GetTestClient()
server, client := FlickrMock(200, bodyStr, "")
defer server.Close()
fclient.HTTPClient = client
err := DoPostBody(fclient, bytes.NewBufferString("foo"), "", &FooResponse{})
Expect(t, err, nil)
}
func TestDoPost(t *testing.T) {
fclient := GetTestClient()
fclient.Args.Set("fooArg", "foo way")
params := []string{"fooArg"}
AssertParamsInBody(t, fclient, params)
}