forked from blacklightcms/recurly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_test.go
More file actions
35 lines (27 loc) · 795 Bytes
/
client_test.go
File metadata and controls
35 lines (27 loc) · 795 Bytes
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
package recurly_test
import (
"net/http"
"net/http/httptest"
"github.com/blacklightcms/recurly"
)
var (
// mux is the HTTP request multiplexer used with the test server
mux *http.ServeMux
// server is a test HTTP server used to provide mock API responses
server *httptest.Server
// client is the Recurly client being tested
client *recurly.Client
)
// setup sets up a test HTTP server along with a recurly.Client that is
// configured to talk to that test server. Tests should register handlers on
// mux which provide mock responses for the API method being tested
func setup() {
// test server
mux = http.NewServeMux()
server = httptest.NewServer(mux)
client = recurly.NewClient("test", "abc", nil)
client.BaseURL = server.URL + "/"
}
func teardown() {
server.Close()
}