diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-07-09 16:31:41 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-07-09 16:31:41 +0000 |
commit | d1be4d570b100ee95119d51603109cc95bf7fbba (patch) | |
tree | 132a0c539aa3b381f684ef76b449693fb28dc52b | |
parent | e9b2b4ec11ed4955e61295d0fd5ae6b012a2c65d (diff) | |
parent | 5533018d5cc60007d0abe5b326b4be253e96ef2b (diff) | |
download | python-glanceclient-d1be4d570b100ee95119d51603109cc95bf7fbba.tar.gz |
Merge "Creating task with invalid property crashes in py3" into stable/kilo
-rw-r--r-- | glanceclient/v2/tasks.py | 2 | ||||
-rw-r--r-- | tests/v2/test_tasks.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/glanceclient/v2/tasks.py b/glanceclient/v2/tasks.py index 3780191..8ad039f 100644 --- a/glanceclient/v2/tasks.py +++ b/glanceclient/v2/tasks.py @@ -110,7 +110,7 @@ class Controller(object): try: setattr(task, key, value) except warlock.InvalidOperation as e: - raise TypeError(unicode(e)) + raise TypeError(utils.exception_to_str(e)) resp, body = self.http_client.post(url, data=task) #NOTE(flwang): remove 'self' for now until we have an elegant diff --git a/tests/v2/test_tasks.py b/tests/v2/test_tasks.py index a5491a3..4e1f78c 100644 --- a/tests/v2/test_tasks.py +++ b/tests/v2/test_tasks.py @@ -187,6 +187,7 @@ schema_fixtures = { 'result': {}, 'message': {}, }, + 'additionalProperties': False, } ) } @@ -275,3 +276,10 @@ class TestController(testtools.TestCase): task = self.controller.create(**properties) self.assertEqual(task.id, '3a4560a1-e585-443e-9b39-553b46ec92d1') self.assertEqual(task.type, 'import') + + def test_create_task_invalid_property(self): + properties = { + 'type': 'import', + 'bad_prop': 'value', + } + self.assertRaises(TypeError, self.controller.create, **properties) |