mirror of https://github.com/docker/docker-py.git
Separate check_resource inspect tests
This commit is contained in:
parent
9cdf1dc6ef
commit
fe12dad21b
|
|
@ -1781,18 +1781,21 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
|
||||||
self.client.inspect_container(fake_api.FAKE_CONTAINER_ID)
|
self.client.inspect_container(fake_api.FAKE_CONTAINER_ID)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail('Command should not raise exception: {0}'.format(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(
|
fake_request.assert_called_with(
|
||||||
url_prefix + 'containers/3cc2351ab11b/json',
|
url_prefix + 'containers/3cc2351ab11b/json',
|
||||||
timeout=DEFAULT_TIMEOUT_SECONDS
|
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):
|
def test_container_stats(self):
|
||||||
try:
|
try:
|
||||||
self.client.stats(fake_api.FAKE_CONTAINER_ID)
|
self.client.stats(fake_api.FAKE_CONTAINER_ID)
|
||||||
|
|
@ -1959,17 +1962,21 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail('Command should not raise exception: {0}'.format(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(
|
fake_request.assert_called_with(
|
||||||
url_prefix + 'images/test_image/json',
|
url_prefix + 'images/test_image/json',
|
||||||
timeout=DEFAULT_TIMEOUT_SECONDS
|
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):
|
def test_insert_image(self):
|
||||||
try:
|
try:
|
||||||
self.client.insert(fake_api.FAKE_IMAGE_NAME,
|
self.client.insert(fake_api.FAKE_IMAGE_NAME,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue