Add integration test for named container creation

Signed-off-by: Maxime Petazzoni <max@signalfuse.com>
This commit is contained in:
Maxime Petazzoni 2013-11-07 15:37:41 -08:00
parent f344d8e65f
commit afb349d257
1 changed files with 11 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class BaseTestCase(unittest.TestCase):
tmp_containers = [] tmp_containers = []
def setUp(self): def setUp(self):
self.client = docker.Client() self.client = docker.Client(version="1.6")
self.client.pull('busybox') self.client.pull('busybox')
self.tmp_imgs = [] self.tmp_imgs = []
self.tmp_containers = [] self.tmp_containers = []
@ -168,6 +168,16 @@ class TestCreateContainerPrivileged(BaseTestCase):
self.assertEqual(inspect['Config']['Privileged'], True) self.assertEqual(inspect['Config']['Privileged'], True)
class TestCreateContainerWithName(BaseTestCase):
def runTest(self):
res = self.client.create_container('busybox', 'true', name='foobar')
self.assertIn('Id', res)
self.tmp_containers.append(res['Id'])
inspect = self.client.inspect_container(res['Id'])
self.assertIn('Name', inspect)
self.assertEqual('/foobar', inspect['Name'])
class TestStartContainer(BaseTestCase): class TestStartContainer(BaseTestCase):
def runTest(self): def runTest(self):
res = self.client.create_container('busybox', 'true') res = self.client.create_container('busybox', 'true')