Merge pull request #3612 from dnephin/tests_for_bundle

Add some unit tests and an acceptance test for bundle
This commit is contained in:
Aanand Prasad 2016-06-28 14:47:29 -07:00 committed by GitHub
commit 72d3d5d84b
5 changed files with 306 additions and 20 deletions

View file

@ -12,6 +12,7 @@ from collections import Counter
from collections import namedtuple
from operator import attrgetter
import py
import yaml
from docker import errors
@ -378,6 +379,32 @@ class CLITestCase(DockerClientTestCase):
]
assert not containers
def test_bundle_with_digests(self):
self.base_dir = 'tests/fixtures/bundle-with-digests/'
tmpdir = py.test.ensuretemp('cli_test_bundle')
self.addCleanup(tmpdir.remove)
filename = str(tmpdir.join('example.dab'))
self.dispatch(['bundle', '--output', filename])
with open(filename, 'r') as fh:
bundle = json.load(fh)
assert bundle == {
'Version': '0.1',
'Services': {
'web': {
'Image': ('dockercloud/hello-world@sha256:fe79a2cfbd17eefc3'
'44fb8419420808df95a1e22d93b7f621a7399fd1e9dca1d'),
'Networks': ['default'],
},
'redis': {
'Image': ('redis@sha256:a84cb8f53a70e19f61ff2e1d5e73fb7ae62d'
'374b2b7392de1e7d77be26ef8f7b'),
'Networks': ['default'],
}
},
}
def test_create(self):
self.dispatch(['create'])
service = self.project.get_service('simple')