Fix the test_list_enabled_api_versions
This patch updates the test_list_enabled_api_versions to accomodate the
update to the API version document to match the OpenStack standard
format.
Change-Id: I7afca000f682cd72478cd45f863fad7d8a80b6f1
diff --git a/designate_tempest_plugin/tests/api/v2/test_enabled_api_version.py b/designate_tempest_plugin/tests/api/v2/test_enabled_api_version.py
index c5fcd69..814802f 100644
--- a/designate_tempest_plugin/tests/api/v2/test_enabled_api_version.py
+++ b/designate_tempest_plugin/tests/api/v2/test_enabled_api_version.py
@@ -45,18 +45,37 @@
def test_list_enabled_api_versions(self):
for user in ['admin', 'primary', 'not_auth_user']:
if user == 'admin':
- versions = self.admin_client.list_enabled_api_versions()[1][
- 'versions']['values']
+ ver_doc = self.admin_client.list_enabled_api_versions()[1]
+ # The version document was updated to match OpenStack
+ # version discovery standards in Zed. Accomodate the legacy
+ # format for backward compatibility.
+ try:
+ versions = ver_doc['versions']['values']
+ except TypeError:
+ versions = ver_doc['versions']
if user == 'primary':
- versions = self.primary_client.list_enabled_api_versions()[1][
- 'versions']['values']
+ ver_doc = self.primary_client.list_enabled_api_versions()[1]
+ # The version document was updated to match OpenStack
+ # version discovery standards in Zed. Accomodate the legacy
+ # format for backward compatibility.
+ try:
+ versions = ver_doc['versions']['values']
+ except TypeError:
+ versions = ver_doc['versions']
if user == 'not_auth_user':
response = requests.get(self.primary_client.base_url,
verify=False)
headers = {
k.lower(): v.lower() for k, v in response.headers.items()}
- versions = self.deserialize(
- headers, str(response.text))['versions']['values']
+ # The version document was updated to match OpenStack
+ # version discovery standards in Zed. Accomodate the legacy
+ # format for backward compatibility.
+ try:
+ versions = self.deserialize(
+ headers, str(response.text))['versions']['values']
+ except TypeError:
+ versions = self.deserialize(
+ headers, str(response.text))['versions']
LOG.info('Received enabled API versions for {} '
'user are:{}'.format(user, versions))
@@ -64,7 +83,7 @@
enabled_ids = [
item['id'] for key in item.keys() if key == 'id']
LOG.info('Enabled versions IDs are:{}'.format(enabled_ids))
- possible_options = [['v1'], ['v2'], ['v1', 'v2']]
+ possible_options = [['v1'], ['v2'], ['v1', 'v2'], ['v2.0']]
self.assertIn(
enabled_ids, possible_options,
'Failed, received version: {} is not in possible options'