def test_add_container_label_no_container_image_type(self): xml_data = self.description.load() state = XMLState(xml_data, ['vmxFlavour'], 'vmx') state.add_container_config_label('somelabel', 'newlabelvalue') with self._caplog.at_level(logging.WARNING): config = state.get_container_config() assert not config
def test_add_container_label_no_container_image_type(self, mock_log_warn): xml_data = self.description.load() state = XMLState(xml_data, ['vmxFlavour'], 'vmx') state.add_container_config_label('somelabel', 'newlabelvalue') config = state.get_container_config() assert not config assert mock_log_warn.called
def test_add_container_label_without_contianerconfig(self): xml_data = self.description.load() state = XMLState(xml_data, ['xenFlavour'], 'docker') state.add_container_config_label('somelabel', 'newlabelvalue') config = state.get_container_config() assert config['labels'] == { 'somelabel': 'newlabelvalue' }
def test_add_container_label(self): xml_data = self.description.load() state = XMLState(xml_data, ['vmxFlavour'], 'docker') state.add_container_config_label('somelabel', 'overwrittenvalue') state.add_container_config_label('new_label', 'new value') config = state.get_container_config() assert config['labels'] == { 'somelabel': 'overwrittenvalue', 'someotherlabel': 'anotherlabelvalue', 'new_label': 'new value' }
def test_add_container_label_no_container_image_type(self): xml_data = self.description.load() state = XMLState(xml_data, ['vmxFlavour'], 'oem') state.add_container_config_label('somelabel', 'newlabelvalue') with self._caplog.at_level(logging.WARNING): config = state.get_container_config() assert config == { 'history': { 'author': 'Marcus <*****@*****.**>' }, 'maintainer': 'Marcus <*****@*****.**>' }