Fix a bad granular gabbi test

A gabbi test for multiple member_of<N> was using the `query_parameters`
keyword to construct the querystring; but it was trying to test what
happens when member_of<N> is specified multiple times. In this test, N
was the same for both, but the query parameters were being entered as
separate dict keys; so the querystring was only being constructed with
the latter value, because yaml [1]. The test was passing spuriously
because it happens to be the case that the result would be the same if
only the latter value is specified. (If you reversed the order of the
two member_ofZ, the test failed.)

This change re-YAMLs the query_parameters to use list syntax for the
values of the member_of key, from which gabbi will dtrt in constructing
the querystring.

NB: It might be nice to find a test scenario where the false positive
wouldn't have been possible; but that would be a bigger effort that
could possibly entail reswizzling the GranularFixture and therefore the
whole gabbit. Done this way, we're at least sure that both values are
making it to the handler; and switching the order in the querystring has
no effect (though the order is apparently not guaranteed/deterministic
anyway [2]).

[1] https://github.com/yaml/pyyaml/issues/165
[2] https://gabbi.readthedocs.io/en/latest/example.html (search for
query_parameters)

Change-Id: I10f28d8c21643be69b67f25dcc043cd9640eac42
This commit is contained in:
Eric Fried 2019-02-25 12:26:11 -06:00
parent 8723768a41
commit a3c3370fea
1 changed files with 3 additions and 2 deletions

View File

@ -262,8 +262,9 @@ tests:
query_parameters:
resources1: VCPU:1
resources2: DISK_GB:100
member_of2: $ENVIRON['AGGA']
member_of2: in:$ENVIRON['AGGB'],$ENVIRON['AGGC']
member_of2:
- in:$ENVIRON['AGGB'],$ENVIRON['AGGC']
- $ENVIRON['AGGA']
group_policy: isolate
status: 200
response_json_paths: