def test_is_filename(self): re = heat.RegistryEntry('Tuskar::compute-1', 'provider-compute-1.yaml') self.assertTrue(re.is_filename()) re = heat.RegistryEntry('OS::TripleO::StructuredDeployment', 'OS::Heat::StructuredDeployment') self.assertFalse(re.is_filename())
def _sample_environment(self): e = heat.Environment() e.add_parameter(heat.EnvironmentParameter('n1', 'v1')) e.add_parameter(heat.EnvironmentParameter('n2', 'v2')) e.add_registry_entry(heat.RegistryEntry('a1', 'f1')) e.add_registry_entry(heat.RegistryEntry('a2', 'f2')) return e
def test_remove_registry_entry_by_namespace(self): # Setup e = heat.Environment() e.add_registry_entry(heat.RegistryEntry('a1', 'f1')) e.add_registry_entry(heat.RegistryEntry('a2', 'f2')) e.add_registry_entry(heat.RegistryEntry('a1', 'f3')) # Test e.remove_registry_entry_by_alias('a1') # Verify self.assertEqual(1, len(e.registry_entries)) self.assertEqual(e.registry_entries[0].filename, 'f2')
def test_add_remove_registry_entry(self): e = heat.Environment() re = heat.RegistryEntry('a', 'f') # Test Add e.add_registry_entry(re) self.assertEqual(1, len(e.registry_entries)) self.assertEqual(re, e.registry_entries[0]) # Test Remove e.remove_registry_entry(re) self.assertEqual(0, len(e.registry_entries))
def test_remove_registry_entry_not_found(self): e = heat.Environment() self.assertRaises(ValueError, e.remove_registry_entry, heat.RegistryEntry('a', 'f'))