mirror of https://github.com/docker/docker-py.git
Fixed tests
This commit is contained in:
parent
ebaa5efe72
commit
4f7872da87
|
@ -277,8 +277,7 @@ class Client(requests.Session):
|
||||||
'stderr': 1
|
'stderr': 1
|
||||||
}
|
}
|
||||||
u = self._url("/containers/{0}/attach".format(container))
|
u = self._url("/containers/{0}/attach".format(container))
|
||||||
res = self.post(u, None, params=params)
|
return self._result(self.post(u, None, params=params))
|
||||||
return res.text
|
|
||||||
|
|
||||||
def port(self, container, private_port):
|
def port(self, container, private_port):
|
||||||
res = self.get(self._url("/containers/{0}/json".format(container)))
|
res = self.get(self._url("/containers/{0}/json".format(container)))
|
||||||
|
|
|
@ -58,9 +58,9 @@ class TestSearch(BaseTestCase):
|
||||||
class TestImages(BaseTestCase):
|
class TestImages(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
res1 = self.client.images(all=True)
|
res1 = self.client.images(all=True)
|
||||||
res10 = res1[0]
|
self.assertIn('Id', res1[0])
|
||||||
|
res10 = [x for x in res1 if x['Id'].startswith('e9aa60c60128')][0]
|
||||||
self.assertIn('Created', res10)
|
self.assertIn('Created', res10)
|
||||||
self.assertIn('Id', res10)
|
|
||||||
self.assertIn('Repository', res10)
|
self.assertIn('Repository', res10)
|
||||||
self.assertIn('Tag', res10)
|
self.assertIn('Tag', res10)
|
||||||
self.assertEqual(res10['Tag'], 'latest')
|
self.assertEqual(res10['Tag'], 'latest')
|
||||||
|
@ -161,14 +161,14 @@ class TestLogs(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
snippet = 'Flowering Nights (Sakuya Iyazoi)'
|
snippet = 'Flowering Nights (Sakuya Iyazoi)'
|
||||||
container = self.client.create_container('busybox',
|
container = self.client.create_container('busybox',
|
||||||
['echo', '-n', '{0}'.format(snippet)])
|
'echo {0}'.format(snippet))
|
||||||
id = container['Id']
|
id = container['Id']
|
||||||
self.client.start(id)
|
self.client.start(id)
|
||||||
self.tmp_containers.append(id)
|
self.tmp_containers.append(id)
|
||||||
exitcode = self.client.wait(id)
|
exitcode = self.client.wait(id)
|
||||||
self.assertEqual(exitcode, 0)
|
self.assertEqual(exitcode, 0)
|
||||||
logs = self.client.logs(id)
|
logs = self.client.logs(id)
|
||||||
self.assertEqual(logs, snippet)
|
self.assertEqual(logs, snippet + '\n')
|
||||||
|
|
||||||
class TestDiff(BaseTestCase):
|
class TestDiff(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
|
@ -255,6 +255,7 @@ class TestRemoveContainer(BaseTestCase):
|
||||||
class TestPull(BaseTestCase):
|
class TestPull(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
self.client.remove_image('joffrey/test001')
|
self.client.remove_image('joffrey/test001')
|
||||||
|
self.client.remove_image('376968a23351')
|
||||||
info = self.client.info()
|
info = self.client.info()
|
||||||
self.assertIn('Images', info)
|
self.assertIn('Images', info)
|
||||||
img_count = info['Images']
|
img_count = info['Images']
|
||||||
|
@ -264,6 +265,7 @@ class TestPull(BaseTestCase):
|
||||||
img_info = self.client.inspect_image('joffrey/test001')
|
img_info = self.client.inspect_image('joffrey/test001')
|
||||||
self.assertIn('id', img_info)
|
self.assertIn('id', img_info)
|
||||||
self.tmp_imgs.append('joffrey/test001')
|
self.tmp_imgs.append('joffrey/test001')
|
||||||
|
self.tmp_imgs.append('376968a23351')
|
||||||
|
|
||||||
class TestCommit(BaseTestCase):
|
class TestCommit(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
|
|
Loading…
Reference in New Issue