Fix validation of begin/end in GET /v2/summary endpoint
Before this patch, if any of the "begin" and "end" parameters were passed to the GET /v2/summary endpoint, validation would fail. This was caused by "voluptuous.Coerce" being used instead of the custom "SingleQueryParam" validator. Change-Id: I09656c742f3ba6b02de3656201f6903f590944bd
This commit is contained in:
parent
c09714be7f
commit
c841ee8c29
|
@ -29,8 +29,10 @@ class Summary(base.BaseResource):
|
|||
voluptuous.Optional('groupby'): api_utils.MultiQueryParam(str),
|
||||
voluptuous.Optional('filters'):
|
||||
api_utils.SingleDictQueryParam(str, str),
|
||||
voluptuous.Optional('begin'): voluptuous.Coerce(tzutils.dt_from_iso),
|
||||
voluptuous.Optional('end'): voluptuous.Coerce(tzutils.dt_from_iso),
|
||||
voluptuous.Optional('begin'): api_utils.SingleQueryParam(
|
||||
tzutils.dt_from_iso),
|
||||
voluptuous.Optional('end'): api_utils.SingleQueryParam(
|
||||
tzutils.dt_from_iso),
|
||||
})
|
||||
def get(self, groupby=None, filters={},
|
||||
begin=None, end=None,
|
||||
|
|
|
@ -58,3 +58,13 @@ tests:
|
|||
response_json_paths:
|
||||
$.results.`len`: 5
|
||||
$.total: 14
|
||||
|
||||
- name: Get a summary with a start and end date
|
||||
url: /v2/summary
|
||||
status: 200
|
||||
query_parameters:
|
||||
begin: "2017-01-01T00:00:00+00:00"
|
||||
end: "2017-01-02T00:00:00+00:00"
|
||||
response_json_paths:
|
||||
$.results.`len`: 0
|
||||
$.total: 0
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
A validation issue causing the ``GET /v2/summary`` endpoint to
|
||||
systematically return a 400 error if any of the ``begin`` or ``end``
|
||||
parameters was specified has been fixed.
|
Loading…
Reference in New Issue