forked from sogko/go-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 2
/
types_test.go
42 lines (37 loc) · 875 Bytes
/
types_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
39
40
41
42
package wordpress_test
import (
"net/http"
"testing"
)
func TestTypesList(t *testing.T) {
wp := initTestClient()
types, resp, body, err := wp.Types().List(nil)
if err != nil {
t.Errorf("Should not return error: %v", err.Error())
}
if resp.StatusCode != http.StatusOK {
t.Errorf("Expected 200 OK, got %v", resp.Status)
}
if body == nil {
t.Errorf("Should not return nil body")
}
if types == nil {
t.Errorf("Should not return nil types")
}
}
func TestTypesGet(t *testing.T) {
wp := initTestClient()
wpType, resp, body, err := wp.Types().Get("post", nil)
if err != nil {
t.Errorf("Should not return error: %v", err.Error())
}
if resp.StatusCode != http.StatusOK {
t.Errorf("Expected 200 OK, got %v", resp.Status)
}
if body == nil {
t.Errorf("Should not return nil body")
}
if wpType == nil {
t.Errorf("Should not return nil type")
}
}