forked from sogko/go-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 2
/
statuses_test.go
42 lines (37 loc) · 901 Bytes
/
statuses_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 TestStatusesList(t *testing.T) {
wp := initTestClient()
statuses, resp, body, err := wp.Statuses().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 statuses == nil {
t.Errorf("Should not return nil statuses")
}
}
func TestStatusesGet(t *testing.T) {
wp := initTestClient()
status, resp, body, err := wp.Statuses().Get("publish", 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 status == nil {
t.Errorf("Should not return nil status")
}
}