diff options
author | Andrew Lazarev <alazarev@mirantis.com> | 2014-02-04 15:09:35 -0800 |
---|---|---|
committer | Andrew Lazarev <alazarev@mirantis.com> | 2014-02-04 16:00:14 -0800 |
commit | 788e05c0df1fb5e94ae355b2929000445006d8f2 (patch) | |
tree | d3ab8977b459a28cb31e44ba3c495a3aa446c9b9 | |
parent | 810857849ed32773c38df12785715f89d33e83af (diff) | |
download | python-novaclient-788e05c0df1fb5e94ae355b2929000445006d8f2.tar.gz |
Fixed multi validation and wrong fail calls in unit tests
* Positive test was calling the same check several times. Replaced
with one call.
* Negative test was failing with "'object has no attribute 'assertFail'"
error message in case of failure. Replaced with appropriate message.
Change-Id: Id03a452f7735d6b4d13f54036f1bd3ae50cb487a
-rw-r--r-- | novaclient/tests/test_utils.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/novaclient/tests/test_utils.py b/novaclient/tests/test_utils.py index cce2db02..ba680119 100644 --- a/novaclient/tests/test_utils.py +++ b/novaclient/tests/test_utils.py @@ -291,14 +291,13 @@ class FlattenTestCase(test_utils.TestCase): class ValidationsTestCase(test_utils.TestCase): def test_validate_flavor_metadata_keys_with_valid_keys(self): valid_keys = ['key1', 'month.price', 'I-Am:AK-ey.01-', 'spaces and _'] - for key in valid_keys: - utils.validate_flavor_metadata_keys(valid_keys) + utils.validate_flavor_metadata_keys(valid_keys) def test_validate_flavor_metadata_keys_with_invalid_keys(self): invalid_keys = ['/1', '?1', '%1', '<', '>', '\1'] for key in invalid_keys: try: utils.validate_flavor_metadata_keys([key]) - self.assertFail() + self.fail("Invalid key passed validation: %s" % key) except exceptions.CommandError as ce: self.assertTrue(key in str(ce)) |