forked from Virtomize/confluence-go-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_test.go
36 lines (29 loc) · 800 Bytes
/
search_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 goconfluence
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSearchQueryParams(t *testing.T) {
query := SearchQuery{
CQL: "test",
CQLContext: "test",
IncludeArchivedSpaces: true,
Limit: 1,
Start: 1,
}
p := addSearchQueryParams(query)
assert.Equal(t, p.Get("cql"), "test")
assert.Equal(t, p.Get("cqlcontext"), "test")
assert.Equal(t, p.Get("includeArchivedSpaces"), "true")
assert.Equal(t, p.Get("limit"), "1")
assert.Equal(t, p.Get("start"), "1")
}
func TestSearch(t *testing.T) {
server := confluenceRestAPIStub()
defer server.Close()
api, err := NewAPI(server.URL+"/wiki/rest/api", "userame", "token")
assert.Nil(t, err)
s, err := api.Search(SearchQuery{})
assert.Nil(t, err)
assert.Equal(t, &Search{}, s)
}