forked from cloudant-labs/go-cloudant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalldocs_query_test.go
59 lines (53 loc) · 1.07 KB
/
alldocs_query_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
56
57
58
59
package cloudant
import (
"strings"
"testing"
)
func TestAllDocsQuery_Args(t *testing.T) {
// Conflicts bool
// DeletedConflicts bool
// Descending bool
// EndKey string
// IncludeDocs bool
// InclusiveEnd bool
// Key string
// Keys []string
// Limit int
// Meta bool
// R int
// RevsInfo bool
// Skip int
// StartKey string
expectedQueryStrings := []string{
"conflicts=true",
"deleted_conflicts=true",
"descending=true",
"include_docs=true",
"inclusive_end=true",
"limit=5",
"meta=true",
"r=2",
"revs_info=true",
"skip=32",
}
query := NewAllDocsQuery().
Conflicts().
DeletedConflicts().
Descending().
IncludeDocs().
InclusiveEnd().
Limit(5).
Meta().
R(2).
RevsInfo().
Skip(32).
Build()
values, _ := query.GetQuery()
queryString := values.Encode()
for _, str := range expectedQueryStrings {
if !strings.Contains(queryString, str) {
t.Errorf("parameter encoding not found '%s'", str)
return
}
}
}