Separate check_resource inspect tests

This commit is contained in:
Joffrey F 2015-05-20 14:46:51 -07:00
parent 9cdf1dc6ef
commit fe12dad21b
1 changed files with 20 additions and 13 deletions

View File

@ -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,