mirror of https://github.com/docker/compose.git
Add test for ServiceCollection.get
This commit is contained in:
parent
2199b62783
commit
f0768d4dca
|
@ -16,12 +16,10 @@ class ServiceCollectionTest(ServiceTestCase):
|
|||
}
|
||||
])
|
||||
self.assertEqual(len(collection), 2)
|
||||
web = [s for s in collection if s.name == 'web'][0]
|
||||
self.assertEqual(web.name, 'web')
|
||||
self.assertEqual(web.image, 'ubuntu')
|
||||
db = [s for s in collection if s.name == 'db'][0]
|
||||
self.assertEqual(db.name, 'db')
|
||||
self.assertEqual(db.image, 'ubuntu')
|
||||
self.assertEqual(collection.get('web').name, 'web')
|
||||
self.assertEqual(collection.get('web').image, 'ubuntu')
|
||||
self.assertEqual(collection.get('db').name, 'db')
|
||||
self.assertEqual(collection.get('db').image, 'ubuntu')
|
||||
|
||||
def test_from_dict_sorts_in_dependency_order(self):
|
||||
collection = ServiceCollection.from_dicts(None, [
|
||||
|
@ -35,10 +33,15 @@ class ServiceCollectionTest(ServiceTestCase):
|
|||
'image': 'ubuntu'
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
self.assertEqual(collection[0].name, 'db')
|
||||
self.assertEqual(collection[1].name, 'web')
|
||||
|
||||
def test_get(self):
|
||||
web = self.create_service('web')
|
||||
collection = ServiceCollection([web])
|
||||
self.assertEqual(collection.get('web'), web)
|
||||
|
||||
def test_start_stop(self):
|
||||
collection = ServiceCollection([
|
||||
self.create_service('web'),
|
||||
|
|
Loading…
Reference in New Issue