From fe12dad21b909e1dcc08209416b36af678f1c613 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Wed, 20 May 2015 14:46:51 -0700 Subject: [PATCH] Separate check_resource inspect tests --- tests/test.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/test.py b/tests/test.py index 98bb03ff..e0a9e345 100644 --- a/tests/test.py +++ b/tests/test.py @@ -1781,18 +1781,21 @@ class DockerClientTest(Cleanup, base.BaseTestCase): self.client.inspect_container(fake_api.FAKE_CONTAINER_ID) except Exception as e: self.fail('Command should not raise exception: {0}'.format(e)) - - try: - self.client.inspect_container('') - except ValueError as e: - self.assertEqual(e.args[0], - 'image or container param is empty') - fake_request.assert_called_with( url_prefix + 'containers/3cc2351ab11b/json', timeout=DEFAULT_TIMEOUT_SECONDS ) + def test_inspect_container_empty_id(self): + try: + self.client.inspect_container('') + except docker.errors.NullResource as e: + self.assertEqual( + e.args[0], 'image or container param is undefined' + ) + else: + self.fail('Command expected NullResource exception') + def test_container_stats(self): try: self.client.stats(fake_api.FAKE_CONTAINER_ID) @@ -1959,17 +1962,21 @@ class DockerClientTest(Cleanup, base.BaseTestCase): except Exception as e: self.fail('Command should not raise exception: {0}'.format(e)) - try: - self.client.inspect_image('') - except ValueError as e: - self.assertEqual(e.args[0], - 'image or container param is empty') - fake_request.assert_called_with( url_prefix + 'images/test_image/json', timeout=DEFAULT_TIMEOUT_SECONDS ) + def test_inspect_image_empty_id(self): + try: + self.client.inspect_image('') + except docker.errors.NullResource as e: + self.assertEqual( + e.args[0], 'image or container param is undefined' + ) + else: + self.fail('Command expected NullResource exception') + def test_insert_image(self): try: self.client.insert(fake_api.FAKE_IMAGE_NAME,