def test_network_mode_container(self): container_id = 'abcd' network_mode = ContainerNetworkMode( Container(None, {'Id': container_id})) self.assertEqual(network_mode.id, container_id) self.assertEqual(network_mode.mode, 'container:' + container_id) self.assertEqual(network_mode.service_name, None)
def test_network_mode_container(self): container_id = 'abcd' network_mode = ContainerNetworkMode( Container(None, {'Id': container_id})) assert network_mode.id == container_id assert network_mode.mode == 'container:' + container_id assert network_mode.service_name is None
def test_config_dict_with_network_mode_from_container(self): self.mock_client.inspect_image.return_value = {'Id': 'abcd'} container = Container( self.mock_client, {'Id': 'aaabbb', 'Name': '/foo_1'}) service = Service( 'foo', image='example.com/foo', client=self.mock_client, network_mode=ContainerNetworkMode(container)) config_dict = service.config_dict() expected = { 'image_id': 'abcd', 'options': {'image': 'example.com/foo'}, 'links': [], 'networks': {}, 'net': 'aaabbb', 'volumes_from': [], } assert config_dict == expected