-
Notifications
You must be signed in to change notification settings - Fork 24
/
photos_test.go
29 lines (25 loc) · 847 Bytes
/
photos_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
package photos
import (
"testing"
"github.com/masci/flickr.go/flickr"
flickErr "github.com/masci/flickr.go/flickr/error"
)
func TestDelete(t *testing.T) {
fclient := flickr.GetTestClient()
server, client := flickr.FlickrMock(200, `<?xml version="1.0" encoding="utf-8" ?><rsp stat="ok"></rsp>`, "")
defer server.Close()
fclient.HTTPClient = client
resp, err := Delete(fclient, "123456")
flickr.Expect(t, err, nil)
flickr.Expect(t, resp.HasErrors(), false)
}
func TestDeleteKo(t *testing.T) {
fclient := flickr.GetTestClient()
server, client := flickr.FlickrMock(200, `<?xml version="1.0" encoding="utf-8" ?><rsp stat="fail"></rsp>`, "")
defer server.Close()
fclient.HTTPClient = client
resp, err := Delete(fclient, "123456")
_, ok := err.(*flickErr.Error)
flickr.Expect(t, ok, true)
flickr.Expect(t, resp.HasErrors(), true)
}