-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathresponse_test.go
More file actions
46 lines (36 loc) · 884 Bytes
/
response_test.go
File metadata and controls
46 lines (36 loc) · 884 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
41
42
43
44
45
46
package documentdb
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestExpectStatusCode(t *testing.T) {
expecations := []struct {
status int
result bool
message string
}{
{200, true, "tesing 200, should be true"},
{400, false, "tesing 400, should be false"},
}
for _, e := range expecations {
actual := expectStatusCode(200)(e.status)
assert.Equal(t, e.result, actual, e.message)
}
}
func TestExpectStatusCodeXX(t *testing.T) {
expecations := []struct {
status int
result bool
message string
}{
{199, false, "bellow range"},
{200, true, "range begining"},
{250, true, "in range"},
{299, true, "range end"},
{300, false, "above range"},
}
for _, e := range expecations {
actual := expectStatusCodeXX(200)(e.status)
assert.Equal(t, e.result, actual, e.message)
}
}