forked from zubairhamed/betwixt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponse_test.go
36 lines (26 loc) · 1.33 KB
/
response_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
package betwixt
import (
"github.com/stretchr/testify/assert"
. "github.com/zubairhamed/canopus"
"testing"
)
func TestResponse(t *testing.T) {
assert.Equal(t, CoapCodeCreated, Created().GetResponseCode())
assert.Equal(t, Empty(), Created().GetResponseValue())
assert.Equal(t, CoapCodeDeleted, Deleted().GetResponseCode())
assert.Equal(t, Empty(), Deleted().GetResponseValue())
assert.Equal(t, CoapCodeChanged, Changed().GetResponseCode())
assert.Equal(t, Empty(), Changed().GetResponseValue())
assert.Equal(t, CoapCodeContent, Content(String("this is a string")).GetResponseCode())
assert.Equal(t, "this is a string", Content(String("this is a string")).GetResponseValue().GetValue())
assert.Equal(t, CoapCodeBadRequest, BadRequest().GetResponseCode())
assert.Equal(t, Empty(), BadRequest().GetResponseValue())
assert.Equal(t, CoapCodeUnauthorized, Unauthorized().GetResponseCode())
assert.Equal(t, Empty(), Unauthorized().GetResponseValue())
assert.Equal(t, CoapCodeNotFound, NotFound().GetResponseCode())
assert.Equal(t, Empty(), NotFound().GetResponseValue())
assert.Equal(t, CoapCodeMethodNotAllowed, MethodNotAllowed().GetResponseCode())
assert.Equal(t, Empty(), MethodNotAllowed().GetResponseValue())
assert.Equal(t, CoapCodeConflict, Conflict().GetResponseCode())
assert.Equal(t, Empty(), Conflict().GetResponseValue())
}