-
Notifications
You must be signed in to change notification settings - Fork 57
/
template_test.go
55 lines (42 loc) · 1.3 KB
/
template_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
package goconfluence
import (
"net/url"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetContentTemplatesEndpoints(t *testing.T) {
a, err := NewAPI("https://test.test", "", "")
assert.Nil(t, err)
ep, err := a.getContentTemplatesEndpoint()
assert.Nil(t, err)
uri, err := url.ParseRequestURI("https://test.test/template/page")
assert.Nil(t, err)
assert.Equal(t, ep, uri)
}
func TestGetBlueprintTemplatesEndpoints(t *testing.T) {
a, err := NewAPI("https://test.test", "", "")
assert.Nil(t, err)
ep, err := a.getBlueprintTemplatesEndpoint()
assert.Nil(t, err)
uri, err := url.ParseRequestURI("https://test.test/template/blueprint")
assert.Nil(t, err)
assert.Equal(t, ep, uri)
}
func TestBlueprintTemplateGetter(t *testing.T) {
server := confluenceRestAPIStub()
defer server.Close()
api, err := NewAPI(server.URL+"/wiki/rest/api", "userame", "token")
assert.Nil(t, err)
b, err := api.GetBlueprintTemplates(TemplateQuery{})
assert.Nil(t, err)
assert.Equal(t, &TemplateSearch{}, b)
}
func TestContentTemplateGetter(t *testing.T) {
server := confluenceRestAPIStub()
defer server.Close()
api, err := NewAPI(server.URL+"/wiki/rest/api", "userame", "token")
assert.Nil(t, err)
c, err := api.GetContentTemplates(TemplateQuery{})
assert.Nil(t, err)
assert.Equal(t, &TemplateSearch{}, c)
}