def test_from_dict(self): project = Project.from_dicts( "figtest", [{"name": "web", "image": "ubuntu"}, {"name": "db", "image": "ubuntu"}], self.client ) self.assertEqual(len(project.services), 2) self.assertEqual(project.get_service("web").name, "web") self.assertEqual(project.get_service("web").options["image"], "ubuntu") self.assertEqual(project.get_service("db").name, "db") self.assertEqual(project.get_service("db").options["image"], "ubuntu")
def test_from_dict_sorts_in_dependency_order(self): project = Project.from_dicts( "figtest", [{"name": "web", "image": "ubuntu", "links": ["db"]}, {"name": "db", "image": "ubuntu"}], self.client, ) self.assertEqual(project.services[0].name, "db") self.assertEqual(project.services[1].name, "web")
def test_from_dict_sorts_in_dependency_order(self): project = Project.from_dicts('figtest', [{ 'name': 'web', 'image': 'ubuntu', 'links': ['db'], }, { 'name': 'db', 'image': 'ubuntu' }], self.client) self.assertEqual(project.services[0].name, 'db') self.assertEqual(project.services[1].name, 'web')
def test_from_dict(self): project = Project.from_dicts('figtest', [{ 'name': 'web', 'image': 'ubuntu' }, { 'name': 'db', 'image': 'ubuntu' }], self.client) self.assertEqual(len(project.services), 2) self.assertEqual(project.get_service('web').name, 'web') self.assertEqual(project.get_service('web').options['image'], 'ubuntu') self.assertEqual(project.get_service('db').name, 'db') self.assertEqual(project.get_service('db').options['image'], 'ubuntu')
def test_from_dict_sorts_in_dependency_order(self): project = Project.from_dicts('figtest', [ { 'name': 'web', 'image': 'ubuntu', 'links': ['db'], }, { 'name': 'db', 'image': 'ubuntu' } ], self.client) self.assertEqual(project.services[0].name, 'db') self.assertEqual(project.services[1].name, 'web')
def test_from_dict(self): project = Project.from_dicts('figtest', [ { 'name': 'web', 'image': 'ubuntu' }, { 'name': 'db', 'image': 'ubuntu' } ], self.client) self.assertEqual(len(project.services), 2) self.assertEqual(project.get_service('web').name, 'web') self.assertEqual(project.get_service('web').options['image'], 'ubuntu') self.assertEqual(project.get_service('db').name, 'db') self.assertEqual(project.get_service('db').options['image'], 'ubuntu')
def test_from_dict(self): project = Project.from_dicts('figtest', [ { 'name': 'web', 'image': 'busybox:latest' }, { 'name': 'db', 'image': 'busybox:latest' }, ], None) self.assertEqual(len(project.services), 2) self.assertEqual(project.get_service('web').name, 'web') self.assertEqual(project.get_service('web').options['image'], 'busybox:latest') self.assertEqual(project.get_service('db').name, 'db') self.assertEqual(project.get_service('db').options['image'], 'busybox:latest')
def test_from_dict(self): project = Project.from_dicts('figtest', [ { 'name': 'web', 'image': 'busybox:latest' }, { 'name': 'db', 'image': 'busybox:latest' }, ], None) self.assertEqual(len(project.services), 2) self.assertEqual(project.get_service('web').name, 'web') self.assertEqual( project.get_service('web').options['image'], 'busybox:latest') self.assertEqual(project.get_service('db').name, 'db') self.assertEqual( project.get_service('db').options['image'], 'busybox:latest')
def test_from_dict_sorts_in_dependency_order(self): project = Project.from_dicts('figtest', [{ 'name': 'web', 'image': 'busybox:latest', 'links': ['db'], }, { 'name': 'db', 'image': 'busybox:latest', 'volumes_from': ['volume'] }, { 'name': 'volume', 'image': 'busybox:latest', 'volumes': ['/tmp'], }], None) self.assertEqual(project.services[0].name, 'volume') self.assertEqual(project.services[1].name, 'db') self.assertEqual(project.services[2].name, 'web')
def test_from_dict_sorts_in_dependency_order(self): project = Project.from_dicts('figtest', [ { 'name': 'web', 'image': 'busybox:latest', 'links': ['db'], }, { 'name': 'db', 'image': 'busybox:latest', 'volumes_from': ['volume'] }, { 'name': 'volume', 'image': 'busybox:latest', 'volumes': ['/tmp'], } ], None) self.assertEqual(project.services[0].name, 'volume') self.assertEqual(project.services[1].name, 'db') self.assertEqual(project.services[2].name, 'web')
def to_fig_project(self, client): return Project.from_dicts(self.plan.name, self.to_service_dicts, client)