Fix flaky unit test

A unit test was manipulating with a constant which led to
having unexpected fake data and to a failure during unit testing.
The test now copies the contants and changes it only in the scope
of that test.

Change-Id: Icbafb3906ca11d9a17bd34d144a839051373b483
This commit is contained in:
Martin Kopec 2018-05-03 11:56:48 +00:00
parent acac4a41cd
commit 3fcafee74f
1 changed files with 4 additions and 3 deletions

View File

@ -73,11 +73,12 @@ class TestIdentityService(BaseServiceTest):
self.FAKE_IDENTITY_VERSION)
expected_resp = ['v2.1', 'v3.8']
# add not deprecated v2 version to FAKE_IDENTITY_VERSIONS
v2 = {'status': 'stable', 'id': 'v2.1'}
self.FAKE_IDENTITY_VERSIONS['versions']['values'].append(v2)
v2 = [{'status': 'stable', 'id': 'v2.1'}]
versions = self.FAKE_IDENTITY_VERSIONS['versions']['values'] + v2
fake_versions = {'versions': {'values': versions}}
self._test_deserialize_versions(self.Service,
expected_resp,
self.FAKE_IDENTITY_VERSIONS)
fake_versions)
@mock.patch('config_tempest.services.identity'
'.IdentityService.get_versions')