summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-09-27 18:26:36 +0000
committerGerrit Code Review <review@openstack.org>2012-09-27 18:26:36 +0000
commit0d565de78b5cc8ecdd18e10444ec731db46b48eb (patch)
treee2827ed17054bc1d7df8f55e5a4c89e0af1ab729 /nova
parent7783503105a76bcc74060de460ad56d19fc59942 (diff)
parent24e6e4f4963ab5cd837bb657a157033b3ad9df33 (diff)
downloadnova-0d565de78b5cc8ecdd18e10444ec731db46b48eb.tar.gz
nova-0d565de78b5cc8ecdd18e10444ec731db46b48eb.tar.xz
nova-0d565de78b5cc8ecdd18e10444ec731db46b48eb.zip
Merge "Enable list with no dict objects to be sorted in api samples"
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/integrated/test_api_samples.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index c9d0fddd7..df239db2a 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -145,12 +145,15 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
# which order in different way when using a private key itself or
# its regular expression, and after all doesn't interfere with
# other tests.
+ # Besides that, there are some cases like Aggregates extension
+ # where we got a list of strings. For those cases key will be None
+ # (python's default) and the elements will be compared directly.
# Should we define a criteria when ordering json? Doesn't seems
# necessary so far.
- for ex_obj, res_obj in zip(sorted(expected, key=lambda k:
- k.get('__tag__', k)),
- sorted(result, key=lambda k:
- k.get('__tag__', k))):
+ key = (lambda k: k.get('__tag__', k) if isinstance(k, dict)
+ else None)
+ for ex_obj, res_obj in zip(sorted(expected, key=key),
+ sorted(result, key=key)):
res = self._compare_result(subs, ex_obj, res_obj)
matched_value = res or matched_value