1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix Python 3.7 syntax error in tests.

This commit is contained in:
Matt Clay 2018-01-09 15:15:44 -08:00
parent ef48448e4a
commit cd205854a4
2 changed files with 46 additions and 47 deletions

View file

@ -1,3 +1,2 @@
lib/ansible/cli/adhoc.py lib/ansible/cli/adhoc.py
lib/ansible/modules/packaging/os/yum_repository.py lib/ansible/modules/packaging/os/yum_repository.py
test/units/modules/network/nuage/test_nuage_vspk.py

View file

@ -43,8 +43,8 @@ class TestNuageVSPKModule(TestNuageModule):
self.patches = [] self.patches = []
def enterprises_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def enterprises_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
if 'unknown' in filter: if 'unknown' in filter:
@ -59,7 +59,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.enterprises_get_mock.start() self.enterprises_get_mock.start()
self.patches.append(self.enterprises_get_mock) self.patches.append(self.enterprises_get_mock)
def enterprises_get_first(self, filter=None, order_by=None, group_by=None, query_parameters=None, commit=False, async=False, callback=None): def enterprises_get_first(self, filter=None, order_by=None, group_by=None, query_parameters=None, commit=False, callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
if filter == 'name == "test-enterprise-create"' or 'unknown' in filter: if filter == 'name == "test-enterprise-create"' or 'unknown' in filter:
@ -70,14 +70,14 @@ class TestNuageVSPKModule(TestNuageModule):
self.enterprises_get_first_mock.start() self.enterprises_get_first_mock.start()
self.patches.append(self.enterprises_get_first_mock) self.patches.append(self.enterprises_get_first_mock)
def enterprise_delete(self, response_choice=1, async=False, callback=None): def enterprise_delete(self, response_choice=1, callback=None, **kwargs):
pass pass
self.enterprise_delete_mock = patch('vspk.v5_0.NUEnterprise.delete', new=enterprise_delete) self.enterprise_delete_mock = patch('vspk.v5_0.NUEnterprise.delete', new=enterprise_delete)
self.enterprise_delete_mock.start() self.enterprise_delete_mock.start()
self.patches.append(self.enterprise_delete_mock) self.patches.append(self.enterprise_delete_mock)
def enterprise_fetch(self, async=False, callback=None): def enterprise_fetch(self, callback=None, **kwargs):
self.id = 'enterprise-id' self.id = 'enterprise-id'
self.name = 'test-enterprise' self.name = 'test-enterprise'
@ -85,7 +85,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.enterprise_fetch_mock.start() self.enterprise_fetch_mock.start()
self.patches.append(self.enterprise_fetch_mock) self.patches.append(self.enterprise_fetch_mock)
def enterprise_save(self, response_choice=None, async=False, callback=None): def enterprise_save(self, response_choice=None, callback=None, **kwargs):
self.id = 'enterprise-id' self.id = 'enterprise-id'
self.name = 'test-enterprise-update' self.name = 'test-enterprise-update'
@ -93,7 +93,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.enterprise_save_mock.start() self.enterprise_save_mock.start()
self.patches.append(self.enterprise_save_mock) self.patches.append(self.enterprise_save_mock)
def enterprise_create_child(self, nurest_object, response_choice=None, async=False, callback=None, commit=True): def enterprise_create_child(self, nurest_object, response_choice=None, callback=None, commit=True, **kwargs):
nurest_object.id = 'user-id-create' nurest_object.id = 'user-id-create'
return nurest_object return nurest_object
@ -101,7 +101,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.enterprise_create_child_mock.start() self.enterprise_create_child_mock.start()
self.patches.append(self.enterprise_create_child_mock) self.patches.append(self.enterprise_create_child_mock)
def me_create_child(self, nurest_object, response_choice=None, async=False, callback=None, commit=True): def me_create_child(self, nurest_object, response_choice=None, callback=None, commit=True, **kwargs):
nurest_object.id = 'enterprise-id-create' nurest_object.id = 'enterprise-id-create'
return nurest_object return nurest_object
@ -109,7 +109,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.me_create_child_mock.start() self.me_create_child_mock.start()
self.patches.append(self.me_create_child_mock) self.patches.append(self.me_create_child_mock)
def user_fetch(self, async=False, callback=None): def user_fetch(self, callback=None, **kwargs):
self.id = 'user-id' self.id = 'user-id'
self.first_name = 'John' self.first_name = 'John'
self.last_name = 'Doe' self.last_name = 'Doe'
@ -121,7 +121,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.user_fetch_mock.start() self.user_fetch_mock.start()
self.patches.append(self.user_fetch_mock) self.patches.append(self.user_fetch_mock)
def user_save(self, response_choice=None, async=False, callback=None): def user_save(self, response_choice=None, callback=None, **kwargs):
self.id = 'user-id' self.id = 'user-id'
self.first_name = 'John' self.first_name = 'John'
self.last_name = 'Doe' self.last_name = 'Doe'
@ -133,8 +133,8 @@ class TestNuageVSPKModule(TestNuageModule):
self.user_save_mock.start() self.user_save_mock.start()
self.patches.append(self.user_save_mock) self.patches.append(self.user_save_mock)
def groups_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def groups_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return [] return []
@ -143,7 +143,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.groups_get_mock.start() self.groups_get_mock.start()
self.patches.append(self.groups_get_mock) self.patches.append(self.groups_get_mock)
def group_fetch(self, async=False, callback=None): def group_fetch(self, callback=None, **kwargs):
self.id = 'group-id' self.id = 'group-id'
self.name = 'group' self.name = 'group'
@ -151,7 +151,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.group_fetch_mock.start() self.group_fetch_mock.start()
self.patches.append(self.group_fetch_mock) self.patches.append(self.group_fetch_mock)
def group_assign(self, objects, nurest_object_type, async=False, callback=None, commit=True): def group_assign(self, objects, nurest_object_type, callback=None, commit=True, **kwargs):
self.id = 'group-id' self.id = 'group-id'
self.name = 'group' self.name = 'group'
@ -159,7 +159,7 @@ class TestNuageVSPKModule(TestNuageModule):
self.group_assign_mock.start() self.group_assign_mock.start()
self.patches.append(self.group_assign_mock) self.patches.append(self.group_assign_mock)
def job_fetch(self, async=False, callback=None): def job_fetch(self, callback=None, **kwargs):
global _LOOP_COUNTER global _LOOP_COUNTER
self.id = 'job-id' self.id = 'job-id'
self.command = 'EXPORT' self.command = 'EXPORT'
@ -418,8 +418,8 @@ class TestNuageVSPKModule(TestNuageModule):
'state': 'present' 'state': 'present'
}) })
def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return [vsdk.NUUser(id='user-id'), vsdk.NUUser(id='user-id-2')] return [vsdk.NUUser(id='user-id'), vsdk.NUUser(id='user-id-2')]
@ -441,8 +441,8 @@ class TestNuageVSPKModule(TestNuageModule):
'state': 'present' 'state': 'present'
}) })
def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return [] return []
@ -501,8 +501,8 @@ class TestNuageVSPKModule(TestNuageModule):
] ]
}) })
def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return [] return []
@ -539,8 +539,8 @@ class TestNuageVSPKModule(TestNuageModule):
] ]
}) })
def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return [] return []
@ -579,8 +579,8 @@ class TestNuageVSPKModule(TestNuageModule):
'state': 'absent' 'state': 'absent'
}) })
def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return [vsdk.NUUser(id='user-id')] return [vsdk.NUUser(id='user-id')]
@ -620,7 +620,7 @@ class TestNuageVSPKModule(TestNuageModule):
'command': 'find' 'command': 'find'
}) })
def group_failed_fetch(self, async=False, callback=None): def group_failed_fetch(self, callback=None, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'})) raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -639,7 +639,7 @@ class TestNuageVSPKModule(TestNuageModule):
'command': 'find' 'command': 'find'
}) })
def enterprise_failed_fetch(self, async=False, callback=None): def enterprise_failed_fetch(self, callback=None, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'})) raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -658,8 +658,8 @@ class TestNuageVSPKModule(TestNuageModule):
'command': 'find' 'command': 'find'
}) })
def enterprises_failed_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def enterprises_failed_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'})) raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'}))
@ -680,7 +680,7 @@ class TestNuageVSPKModule(TestNuageModule):
'state': 'present' 'state': 'present'
}) })
def enterprise_failed_fetch(self, async=False, callback=None): def enterprise_failed_fetch(self, callback=None, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'})) raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -700,7 +700,7 @@ class TestNuageVSPKModule(TestNuageModule):
}) })
def enterprises_failed_get_first(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, def enterprises_failed_get_first(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
async=False, callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'})) raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'}))
@ -719,7 +719,7 @@ class TestNuageVSPKModule(TestNuageModule):
'command': 'get_csp_enterprise' 'command': 'get_csp_enterprise'
}) })
def enterprise_failed_fetch(self, async=False, callback=None): def enterprise_failed_fetch(self, callback=None, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'})) raise BambouHTTPError(MockNuageConnection(status_code='404', reason='Not Found', errors={'description': 'Entity not found'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -740,13 +740,13 @@ class TestNuageVSPKModule(TestNuageModule):
'state': 'present' 'state': 'present'
}) })
def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return [] return []
def group_assign(self, objects, nurest_object_type, async=False, callback=None, commit=True): def group_assign(self, objects, nurest_object_type, callback=None, commit=True, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to assign member'})) raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to assign member'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -768,13 +768,13 @@ class TestNuageVSPKModule(TestNuageModule):
'state': 'absent' 'state': 'absent'
}) })
def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return [vsdk.NUUser(id='user-id'), vsdk.NUUser(id='user-id-2')] return [vsdk.NUUser(id='user-id'), vsdk.NUUser(id='user-id-2')]
def group_assign(self, objects, nurest_object_type, async=False, callback=None, commit=True): def group_assign(self, objects, nurest_object_type, callback=None, commit=True, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to remove member'})) raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to remove member'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -796,7 +796,7 @@ class TestNuageVSPKModule(TestNuageModule):
} }
}) })
def me_create_child(self, nurest_object, response_choice=None, async=False, callback=None, commit=True): def me_create_child(self, nurest_object, response_choice=None, callback=None, commit=True, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to create entity'})) raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to create entity'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -818,7 +818,7 @@ class TestNuageVSPKModule(TestNuageModule):
} }
}) })
def enterprise_save(self, response_choice=None, async=False, callback=None): def enterprise_save(self, response_choice=None, callback=None, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to save entity'})) raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to save entity'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -837,7 +837,7 @@ class TestNuageVSPKModule(TestNuageModule):
'state': 'absent' 'state': 'absent'
}) })
def enterprise_delete(self, response_choice=1, async=False, callback=None): def enterprise_delete(self, response_choice=1, callback=None, **kwargs):
raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to delete entity'})) raise BambouHTTPError(MockNuageConnection(status_code='500', reason='Server exception', errors={'description': 'Unable to delete entity'}))
with self.assertRaises(AnsibleFailJson) as exc: with self.assertRaises(AnsibleFailJson) as exc:
@ -856,7 +856,7 @@ class TestNuageVSPKModule(TestNuageModule):
'command': 'wait_for_job' 'command': 'wait_for_job'
}) })
def job_fetch(self, async=False, callback=None): def job_fetch(self, callback=None, **kwargs):
global _LOOP_COUNTER global _LOOP_COUNTER
self.id = 'job-id' self.id = 'job-id'
self.command = 'EXPORT' self.command = 'EXPORT'
@ -988,8 +988,8 @@ class TestNuageVSPKModule(TestNuageModule):
'state': 'present' 'state': 'present'
}) })
def users_get_first(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get_first(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return None return None
@ -1139,8 +1139,8 @@ class TestNuageVSPKModule(TestNuageModule):
] ]
}) })
def users_get_first(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True, async=False, def users_get_first(self, filter=None, order_by=None, group_by=None, page=None, page_size=None, query_parameters=None, commit=True,
callback=None): callback=None, **kwargs):
group_by = [] if group_by is None else group_by group_by = [] if group_by is None else group_by
return None return None