diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-04-20 21:20:15 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-04-20 21:20:15 +0000 |
commit | 7c38c5144cf598abf465f1f312dcb33d1b42fda5 (patch) | |
tree | f841cd8a3df739c0d2fcc5e9dd255c8d4be56d47 | |
parent | 6de59270e7a90c94ced12ec1fbd25bba8387da34 (diff) | |
parent | a59bd0c7d0f7c3666eb0eb40e36ce981c8e089f0 (diff) | |
download | tempest-7c38c5144cf598abf465f1f312dcb33d1b42fda5.tar.gz |
Merge "Fix test accounts unit test race with networks"
-rw-r--r-- | tempest/tests/common/test_accounts.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py index b17667540..b4048ba99 100644 --- a/tempest/tests/common/test_accounts.py +++ b/tempest/tests/common/test_accounts.py @@ -68,13 +68,8 @@ class TestAccount(base.TestCase): 'password': 'p', 'roles': [cfg.CONF.identity.admin_role]}, {'username': 'test_user12', 'tenant_name': 'test_tenant12', 'password': 'p', 'roles': [cfg.CONF.identity.admin_role]}, - {'username': 'test_user13', 'tenant_name': 'test_tenant13', - 'password': 'p', 'resources': {'network': 'network-1'}}, - {'username': 'test_user14', 'tenant_name': 'test_tenant14', - 'password': 'p', 'roles': ['role-7', 'role-11'], - 'resources': {'network': 'network-2'}}, ] - self.useFixture(mockpatch.Patch( + self.accounts_mock = self.useFixture(mockpatch.Patch( 'tempest.common.accounts.read_accounts_yaml', return_value=self.test_accounts)) cfg.CONF.set_default('test_accounts_file', 'fake_path', group='auth') @@ -281,14 +276,22 @@ class TestAccount(base.TestCase): calls = get_free_hash_mock.mock.mock_calls self.assertEqual(len(calls), 1) args = calls[0][1][0] - self.assertEqual(len(args), 12) + self.assertEqual(len(args), 10) for i in admin_hashes: self.assertNotIn(i, args) def test_networks_returned_with_creds(self): + test_accounts = [ + {'username': 'test_user13', 'tenant_name': 'test_tenant13', + 'password': 'p', 'resources': {'network': 'network-1'}}, + {'username': 'test_user14', 'tenant_name': 'test_tenant14', + 'password': 'p', 'roles': ['role-7', 'role-11'], + 'resources': {'network': 'network-2'}}] + # Clear previous mock using self.test_accounts + self.accounts_mock.cleanUp() self.useFixture(mockpatch.Patch( 'tempest.common.accounts.read_accounts_yaml', - return_value=self.test_accounts)) + return_value=test_accounts)) test_accounts_class = accounts.Accounts('v2', 'test_name') with mock.patch('tempest.services.compute.json.networks_client.' 'NetworksClientJSON.list_networks', |