forked from sogko/go-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclient_test.go
More file actions
40 lines (33 loc) · 788 Bytes
/
Copy pathclient_test.go
File metadata and controls
40 lines (33 loc) · 788 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
36
37
38
39
40
package wordpress_test
import (
"github.com/sogko/go-wordpress"
"os"
"testing"
)
var USER string = os.Getenv("WP_USER")
var PASSWORD string = os.Getenv("WP_PASSWD")
var API_BASE_URL string = os.Getenv("WP_API_URL")
func TestClientNew(t *testing.T) {
client := wordpress.NewClient(&wordpress.Options{
BaseAPIURL: API_BASE_URL,
Username: USER,
Password: PASSWORD,
})
if client == nil {
t.Fatalf("Client should not be nil")
}
}
/**
Test helper functions
*/
// initTestClient creates test wordpress client
func initTestClient() *wordpress.Client {
if API_BASE_URL == "" {
panic("Please set your environment before running the tests")
}
return wordpress.NewClient(&wordpress.Options{
BaseAPIURL: API_BASE_URL,
Username: USER,
Password: PASSWORD,
})
}