-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdomain_test.go
53 lines (47 loc) · 1.2 KB
/
domain_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
package handler_test
import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/xeipuuv/gojsonschema"
)
var domainArrayLoader = gojsonschema.NewStringLoader(`{
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"group": { "type": "string" },
"value": { "type": "string" },
"description": { "type": ["string", "null"] }
},
"required": ["id", "group", "value", "description"],
"additionalProperties": false
}
}`)
func TestDomains(t *testing.T) {
arrSchema, err := gojsonschema.NewSchema(domainArrayLoader)
assert.Nil(t, err)
tests := []HTTPTest{
{
Name: "GetDomains",
URL: "/domains",
Method: http.MethodGet,
ExpectedStatus: http.StatusOK,
ExpectedSchema: arrSchema,
},
{
Name: "GetDomainGroup",
URL: "/domains/groups",
Method: http.MethodGet,
ExpectedStatus: http.StatusOK,
},
{
Name: "ListTimezoneOptions",
URL: "/domains/timezones",
Method: http.MethodGet,
ExpectedStatus: http.StatusOK,
},
}
RunAll(t, tests)
}