-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
expect_formvalues.go
91 lines (77 loc) · 3.02 KB
/
expect_formvalues.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package hit
//nolint:dupl // the methods of IExpectFormValues and IExpectHeaders are the same however the comments are different.
// IExpectFormValues provides assertions on the http response body FormValues.
type IExpectFormValues interface {
// Contains expects the specific header to contain all of the specified values.
//
// Usage:
// Expect().Body().FormValues("username").Contains("joe")
Contains(values ...interface{}) IStep
// NotContains expects the specified header to not contain all of the specified values.
//
// Usage:
// Expect().Body().FormValues("username").NotContains("joe")
NotContains(values ...interface{}) IStep
// OneOf expects the specified header to contain one of the specified values.
//
// Usage:
// Expect().Body().FormValues("username").OneOf("joe", "alice")
OneOf(values ...interface{}) IStep
// NotOneOf expects the specified header to not contain one of the specified values.
//
// Usage:
// Expect().Body().FormValues("username").NotOneOf("joe", "alice")
NotOneOf(values ...interface{}) IStep
// Empty expects the specified header to be empty.
//
// Usage:
// Expect().Body().FormValues("username").Empty()
Empty() IStep
// NotEmpty expects the specified header to be empty.
//
// Usage:
// Expect().Body().FormValues("username").NotEmpty()
NotEmpty() IStep
// Len expects the specified header to be the same length then specified.
//
// Usage:
// Expect().Body().FormValues("username").Len().GreaterThan(0)
Len() IExpectInt
// Equal expects the specified header to be equal the specified value.
//
// Usage:
// Expect().Body().FormValues("username").Equal("joe")
// Expect().Body().FormValues("usernames").Equal("joe", "alice")
// Expect().Body().FormValues("length").Equal(10)
Equal(value ...interface{}) IStep
// NotEqual expects the specified header to be not equal the specified value.
//
// Usage:
// Expect().Body().FormValues("username").NotEqual("joe")
// Expect().Body().FormValues("usernames").NotEqual("joe", "alice")
// Expect().Body().FormValues("length").NotEqual(10)
NotEqual(value ...interface{}) IStep
// First provides assertions for the first value of the specified form value.
//
// Usage:
// Expect().Body().FormValues("username").First().NotEqual("joe")
First() IExpectHeaderValue
// Last provides assertions for the last value of the specified header.
//
// Usage:
// Expect().Body().FormValues("username").Last().NotEqual("joe")
Last() IExpectHeaderValue
// Nth provides assertions for the nth value of the specified header. (0 = first value)
//
// Usage:
// Expect().Body().FormValues("username").Nth(0).NotEqual("joe")
Nth(n int) IExpectHeaderValue
}
// since we reuse IExpectHeaders here, make sure IExpectFormValues has everything IExpectHeader has.
var _ IExpectHeaders = IExpectFormValues(nil)
func newExpectFormValues(cleanPath callPath, valueCallback expectHeaderValueCallback) IExpectFormValues {
return &expectHeader{
cleanPath: cleanPath,
valueCallback: valueCallback,
}
}