forked from SpirentOrion/luddite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resource_test.go
135 lines (118 loc) · 3.84 KB
/
resource_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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package luddite
import (
"fmt"
"net/http"
"testing"
)
func TestNotImplementedResourceId(t *testing.T) {
ni := &NotImplementedResource{}
ret := ni.Id(nil)
if ret != "" {
t.Error("failed to retrieve Id")
}
}
func TestNotImplementedResourceList(t *testing.T) {
ni := &NotImplementedResource{}
ret, _ := ni.List(nil)
if ret != http.StatusNotImplemented {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusNotImplemented, ret))
}
}
func TestNotImplementedResourceCount(t *testing.T) {
ni := &NotImplementedResource{}
ret, _ := ni.Count(nil)
if ret != http.StatusNotImplemented {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusNotImplemented, ret))
}
}
func TestNotImplementedResourceGet(t *testing.T) {
ni := &NotImplementedResource{}
ret, _ := ni.Get(nil, "")
if ret != http.StatusNotImplemented {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusNotImplemented, ret))
}
}
func TestNotImplementedResourceCreate(t *testing.T) {
ni := &NotImplementedResource{}
ret, _ := ni.Create(nil, nil)
if ret != http.StatusNotImplemented {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusNotImplemented, ret))
}
}
func TestNotImplementedResourceUpdate(t *testing.T) {
ni := &NotImplementedResource{}
ret, _ := ni.Update(nil, "", nil)
if ret != http.StatusNotImplemented {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusNotImplemented, ret))
}
}
func TestNotImplementedResourceDelete(t *testing.T) {
ni := &NotImplementedResource{}
ret, _ := ni.Delete(nil, "")
if ret != http.StatusNotImplemented {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusNotImplemented, ret))
}
}
func TestNotImplementedResourceAction(t *testing.T) {
ni := &NotImplementedResource{}
ret, _ := ni.Action(nil, "", "")
if ret != http.StatusNotImplemented {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusNotImplemented, ret))
}
}
func TestMethodNotAllowedResourceId(t *testing.T) {
ni := &MethodNotAllowedResource{}
ret := ni.Id(nil)
if ret != "" {
t.Error("failed to retrieve Id")
}
}
func TestMethodNotAllowedResourceList(t *testing.T) {
ni := &MethodNotAllowedResource{}
ret, _ := ni.List(nil)
if ret != http.StatusMethodNotAllowed {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusMethodNotAllowed, ret))
}
}
func TestMethodNotAllowedResourceCount(t *testing.T) {
ni := &MethodNotAllowedResource{}
ret, _ := ni.Count(nil)
if ret != http.StatusMethodNotAllowed {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusMethodNotAllowed, ret))
}
}
func TestMethodNotAllowedResourceGet(t *testing.T) {
ni := &MethodNotAllowedResource{}
ret, _ := ni.Get(nil, "")
if ret != http.StatusMethodNotAllowed {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusMethodNotAllowed, ret))
}
}
func TestMethodNotAllowedResourceCreate(t *testing.T) {
ni := &MethodNotAllowedResource{}
ret, _ := ni.Create(nil, nil)
if ret != http.StatusMethodNotAllowed {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusMethodNotAllowed, ret))
}
}
func TestMethodNotAllowedResourceUpdate(t *testing.T) {
ni := &MethodNotAllowedResource{}
ret, _ := ni.Update(nil, "", nil)
if ret != http.StatusMethodNotAllowed {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusMethodNotAllowed, ret))
}
}
func TestMethodNotAllowedResourceDelete(t *testing.T) {
ni := &MethodNotAllowedResource{}
ret, _ := ni.Delete(nil, "")
if ret != http.StatusMethodNotAllowed {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusMethodNotAllowed, ret))
}
}
func TestMethodNotAllowedResourceAction(t *testing.T) {
ni := &MethodNotAllowedResource{}
ret, _ := ni.Action(nil, "", "")
if ret != http.StatusMethodNotAllowed {
t.Error(fmt.Sprintf("failed, expected %d but was %d", http.StatusMethodNotAllowed, ret))
}
}