You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/filter/filter_validation.feature
+28-89
Original file line number
Diff line number
Diff line change
@@ -10,161 +10,100 @@ Feature: Validate filters based upon filter description
10
10
11
11
Scenario: Required filter that does not allow empty value should throw an error if empty
12
12
When I am on "/filter_validators?required=&required-allow-empty=&arrayRequired[foo]="
13
-
Then the response status code should be 400
14
-
And the JSON node "detail" should be equal to 'Query parameter "required" does not allow empty value'
13
+
Then the response status code should be 422
14
+
And the JSON node "detail" should be equal to 'required: This value should not be blank.'
15
15
16
16
Scenario: Required filter should throw an error if not set
17
17
When I am on "/filter_validators"
18
-
Then the response status code should be 400
19
-
And the JSON node "detail" should match '/^Query parameter "required" is required\nQuery parameter "required-allow-empty" is required$/'
18
+
Then the response status code should be 422
19
+
And the JSON node "detail" should be equal to 'required: This value should not be blank.\nrequired-allow-empty: The parameter "required-allow-empty" is required.'
20
20
21
21
Scenario: Required filter should not throw an error if set
22
22
When I am on "/array_filter_validators?arrayRequired[]=foo&indexedArrayRequired[foo]=foo"
23
23
Then the response status code should be 200
24
24
25
25
Scenario: Required filter should throw an error if not set
26
26
When I am on "/array_filter_validators"
27
-
Then the response status code should be 400
28
-
And the JSON node "detail" should match '/^Query parameter "arrayRequired\[\]" is required\nQuery parameter "indexedArrayRequired\[foo\]" is required$/'
29
-
30
-
When I am on "/array_filter_validators?arrayRequired=foo&indexedArrayRequired[foo]=foo"
31
-
Then the response status code should be 400
32
-
And the JSON node "detail" should be equal to 'Query parameter "arrayRequired[]" is required'
27
+
Then the response status code should be 422
28
+
And the JSON node "detail" should be equal to 'arrayRequired: This value should not be blank.\nindexedArrayRequired: This value should not be blank.'
33
29
34
30
When I am on "/array_filter_validators?arrayRequired[foo]=foo"
35
-
Then the response status code should be 400
36
-
And the JSON node "detail" should match '/^Query parameter "arrayRequired\[\]" is required\nQuery parameter "indexedArrayRequired\[foo\]" is required$/'
31
+
Then the response status code should be 422
32
+
And the JSON node "detail" should be equal to 'indexedArrayRequired: This value should not be blank.'
37
33
38
34
When I am on "/array_filter_validators?arrayRequired[]=foo"
39
-
Then the response status code should be 400
40
-
And the JSON node "detail" should be equal to 'Query parameter "indexedArrayRequired[foo]" is required'
41
-
42
-
When I am on "/array_filter_validators?arrayRequired[]=foo&indexedArrayRequired[bar]=bar"
43
-
Then the response status code should be 400
44
-
And the JSON node "detail" should be equal to 'Query parameter "indexedArrayRequired[foo]" is required'
35
+
Then the response status code should be 422
36
+
And the JSON node "detail" should be equal to 'indexedArrayRequired: This value should not be blank.'
45
37
46
38
Scenario: Test filter bounds: maximum
47
39
When I am on "/filter_validators?required=foo&required-allow-empty&maximum=10"
48
40
Then the response status code should be 200
49
41
50
42
When I am on "/filter_validators?required=foo&required-allow-empty&maximum=11"
51
-
Then the response status code should be 400
52
-
And the JSON node "detail" should be equal to 'Query parameter "maximum" must be less than or equal to 10'
43
+
Then the response status code should be 422
44
+
And the JSON node "detail" should be equal to 'maximum: This value should be less than or equal to 10.'
53
45
54
46
Scenario: Test filter bounds: exclusiveMaximum
55
47
When I am on "/filter_validators?required=foo&required-allow-empty&exclusiveMaximum=9"
56
48
Then the response status code should be 200
57
49
58
50
When I am on "/filter_validators?required=foo&required-allow-empty&exclusiveMaximum=10"
59
-
Then the response status code should be 400
60
-
And the JSON node "detail" should be equal to 'Query parameter "exclusiveMaximum" must be less than 10'
51
+
Then the response status code should be 422
52
+
And the JSON node "detail" should be equal to 'maximum: This value should be less than 10.'
61
53
62
54
Scenario: Test filter bounds: minimum
63
55
When I am on "/filter_validators?required=foo&required-allow-empty&minimum=5"
64
56
Then the response status code should be 200
65
57
66
58
When I am on "/filter_validators?required=foo&required-allow-empty&minimum=0"
67
-
Then the response status code should be 400
68
-
And the JSON node "detail" should be equal to 'Query parameter "minimum" must be greater than or equal to 5'
59
+
Then the response status code should be 422
60
+
And the JSON node "detail" should be equal to 'minimum: This value should be greater than or equal to 5.'
69
61
70
62
Scenario: Test filter bounds: exclusiveMinimum
71
63
When I am on "/filter_validators?required=foo&required-allow-empty&exclusiveMinimum=6"
72
64
Then the response status code should be 200
73
65
74
66
When I am on "/filter_validators?required=foo&required-allow-empty&exclusiveMinimum=5"
75
-
Then the response status code should be 400
76
-
And the JSON node "detail" should be equal to 'Query parameter "exclusiveMinimum" must be greater than 5'
67
+
Then the response status code should be 422
68
+
And the JSON node "detail" should be equal to 'exclusiveMinimum: This value should be greater than 5.'
77
69
78
70
Scenario: Test filter bounds: max length
79
71
When I am on "/filter_validators?required=foo&required-allow-empty&max-length-3=123"
80
72
Then the response status code should be 200
81
73
82
74
When I am on "/filter_validators?required=foo&required-allow-empty&max-length-3=1234"
83
-
Then the response status code should be 400
84
-
And the JSON node "detail" should be equal to 'Query parameter "max-length-3" length must be lower than or equal to 3'
85
-
86
-
Scenario: Do not throw an error if value is not an array
87
-
When I am on "/filter_validators?required=foo&required-allow-empty&max-length-3[]=12345"
88
-
Then the response status code should be 200
75
+
Then the response status code should be 422
76
+
And the JSON node "detail" should be equal to 'max-length-3: This value is too long. It should have 3 characters or less.'
89
77
90
78
Scenario: Test filter bounds: min length
91
79
When I am on "/filter_validators?required=foo&required-allow-empty&min-length-3=123"
92
80
Then the response status code should be 200
93
81
94
82
When I am on "/filter_validators?required=foo&required-allow-empty&min-length-3=12"
95
-
Then the response status code should be 400
96
-
And the JSON node "detail" should be equal to 'Query parameter "min-length-3" length must be greater than or equal to 3'
83
+
Then the response status code should be 422
84
+
And the JSON node "detail" should be equal to 'min-length-3: This value is too short. It should have 3 characters or more.'
97
85
98
86
Scenario: Test filter pattern
99
87
When I am on "/filter_validators?required=foo&required-allow-empty&pattern=pattern"
100
88
When I am on "/filter_validators?required=foo&required-allow-empty&pattern=nrettap"
101
89
Then the response status code should be 200
102
90
103
91
When I am on "/filter_validators?required=foo&required-allow-empty&pattern=not-pattern"
104
-
Then the response status code should be 400
105
-
And the JSON node "detail" should be equal to 'Query parameter "pattern" must match pattern /^(pattern|nrettap)$/'
92
+
Then the response status code should be 422
93
+
And the JSON node "detail" should be equal to 'pattern: This value is not valid.'
106
94
107
95
Scenario: Test filter enum
108
96
When I am on "/filter_validators?required=foo&required-allow-empty&enum=in-enum"
109
97
Then the response status code should be 200
110
98
111
99
When I am on "/filter_validators?required=foo&required-allow-empty&enum=not-in-enum"
112
-
Then the response status code should be 400
113
-
And the JSON node "detail" should be equal to 'Query parameter "enum" must be one of "in-enum, mune-ni"'
100
+
Then the response status code should be 422
101
+
And the JSON node "detail" should be equal to 'enum: The value you selected is not a valid choice.'
114
102
115
103
Scenario: Test filter multipleOf
116
104
When I am on "/filter_validators?required=foo&required-allow-empty&multiple-of=4"
117
105
Then the response status code should be 200
118
106
119
107
When I am on "/filter_validators?required=foo&required-allow-empty&multiple-of=3"
120
-
Then the response status code should be 400
121
-
And the JSON node "detail" should be equal to 'Query parameter "multiple-of" must multiple of 2'
122
-
123
-
Scenario: Test filter array items csv format minItems
124
-
When I am on "/filter_validators?required=foo&required-allow-empty&csv-min-2=a,b"
125
-
Then the response status code should be 200
126
-
127
-
When I am on "/filter_validators?required=foo&required-allow-empty&csv-min-2=a"
128
-
Then the response status code should be 400
129
-
And the JSON node "detail" should be equal to 'Query parameter "csv-min-2" must contain more than 2 values'
130
-
131
-
Scenario: Test filter array items csv format maxItems
132
-
When I am on "/filter_validators?required=foo&required-allow-empty&csv-max-3=a,b,c"
133
-
Then the response status code should be 200
134
-
135
-
When I am on "/filter_validators?required=foo&required-allow-empty&csv-max-3=a,b,c,d"
136
-
Then the response status code should be 400
137
-
And the JSON node "detail" should be equal to 'Query parameter "csv-max-3" must contain less than 3 values'
138
-
139
-
Scenario: Test filter array items tsv format minItems
140
-
When I am on "/filter_validators?required=foo&required-allow-empty&tsv-min-2=a\tb"
141
-
Then the response status code should be 200
142
-
143
-
When I am on "/filter_validators?required=foo&required-allow-empty&tsv-min-2=a,b"
144
-
Then the response status code should be 400
145
-
And the JSON node "detail" should be equal to 'Query parameter "tsv-min-2" must contain more than 2 values'
146
-
147
-
Scenario: Test filter array items pipes format minItems
148
-
When I am on "/filter_validators?required=foo&required-allow-empty&pipes-min-2=a|b"
149
-
Then the response status code should be 200
150
-
151
-
When I am on "/filter_validators?required=foo&required-allow-empty&pipes-min-2=a,b"
152
-
Then the response status code should be 400
153
-
And the JSON node "detail" should be equal to 'Query parameter "pipes-min-2" must contain more than 2 values'
154
-
155
-
Scenario: Test filter array items ssv format minItems
156
-
When I am on "/filter_validators?required=foo&required-allow-empty&ssv-min-2=a b"
157
-
Then the response status code should be 200
158
-
159
-
When I am on "/filter_validators?required=foo&required-allow-empty&ssv-min-2=a,b"
160
-
Then the response status code should be 400
161
-
And the JSON node "detail" should be equal to 'Query parameter "ssv-min-2" must contain more than 2 values'
162
-
163
-
@dropSchema
164
-
Scenario: Test filter array items unique items
165
-
When I am on "/filter_validators?required=foo&required-allow-empty&csv-uniques=a,b"
166
-
Then the response status code should be 200
167
-
168
-
When I am on "/filter_validators?required=foo&required-allow-empty&csv-uniques=a,a"
169
-
Then the response status code should be 400
170
-
And the JSON node "detail" should be equal to 'Query parameter "csv-uniques" must contain unique values'
108
+
Then the response status code should be 422
109
+
And the JSON node "detail" should be equal to 'multiple-of: This value should be a multiple of 2.'
0 commit comments