def test_write_config_setting_no_section(self): fileoperations.create_config_file('ebcli-test', 'us-east-1', 'my-solution-stack') dict = fileoperations._get_yaml_dict(fileoperations.local_config_file) self.assertFalse('mytestsection' in dict) fileoperations.write_config_setting('mytestsection', 'testkey', 'value') dict = fileoperations._get_yaml_dict(fileoperations.local_config_file) self.assertTrue('mytestsection' in dict)
def test_write_config_setting_override(self): fileoperations.create_config_file('ebcli-test', 'us-east-1', 'my-solution-stack') dict = fileoperations._get_yaml_dict(fileoperations.local_config_file) self.assertTrue('global' in dict) self.assertTrue('application_name' in dict['global']) self.assertTrue('application_name' in dict['global']) self.assertEqual(dict['global']['application_name'], 'ebcli-test') fileoperations.write_config_setting('global', 'application_name', 'new_name') dict = fileoperations._get_yaml_dict(fileoperations.local_config_file) self.assertEqual(dict['global']['application_name'], 'new_name')
def list_services(self): compose_path = self.pathconfig.compose_path() compose_dict = fileoperations._get_yaml_dict(compose_path) services = compose.iter_services(compose_dict) # This is the way docker-compose names the containers/services return ['{}_{}_1'.format(self.PROJ_NAME, s) for s in services]
def test_write_config_setting_no_file(self): if os.path.exists(fileoperations.local_config_file): os.remove(fileoperations.local_config_file) self.assertFalse(os.path.exists(fileoperations.local_config_file)) fileoperations.write_config_setting('mytestsection', 'testkey', 'value') self.assertTrue(os.path.exists(fileoperations.local_config_file)) dict = fileoperations._get_yaml_dict(fileoperations.local_config_file) self.assertTrue('mytestsection' in dict)