forked from cloudant-labs/go-cloudant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_query_test.go
57 lines (51 loc) · 1.12 KB
/
get_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
package cloudant
import (
"strings"
"testing"
)
func TestGetQuery_GetArgs(t *testing.T) {
// Attachments bool
// AttEncodingInfo bool
// AttsSince []string
// Conflicts bool
// DeletedConflicts bool
// Latest bool
// LocalSeq bool
// Meta bool
// OpenRevs []string
// Rev string
// Revs bool
// RevsInfo bool
expectedQueryStrings := []string{
"attachments=true",
"att_encoding_info=true",
"conflicts=true",
"deleted_conflicts=true",
"latest=true",
"local_seq=true",
"meta=true",
"rev=1-bf1b7e045f2843995184f78022b3d0f5",
"revs=true",
"revs_info=true",
}
query := NewGetQuery().
Attachments().
AttEncodingInfo().
Conflicts().
DeletedConflicts().
Latest().
LocalSeq().
Meta().
Rev("1-bf1b7e045f2843995184f78022b3d0f5").
Revs().
RevsInfo().
Build()
values, _ := query.GetQuery()
queryString := values.Encode()
for _, str := range expectedQueryStrings {
if !strings.Contains(queryString, str) {
t.Errorf("parameter encoding not found '%s' in '%s'", str, queryString)
return
}
}
}