def remove_parameters_by_namespace(self, namespace): """Removes all parameters in the given namespace. :type namespace: str """ self._parameters = [ p for p in self.parameters if not ns_utils.matches_template_namespace(namespace, p.name)]
def remove_outputs_by_namespace(self, namespace): """Removes all outputs in the given namespace from the template. :type namespace: str """ self._outputs = [ o for o in self.outputs if not ns_utils.matches_template_namespace(namespace, o.name)]
def has_parameter_in_namespace(self, namespace): """Returns true if the environment has at least one parameter in given namespace, false otherwise. :type namespace: str """ for p in self._parameters: if ns_utils.matches_template_namespace(namespace, p.name): return True return False
def test_matches_template_namespace(self): value = 'test-ns::test-name' self.assertTrue(namespace.matches_template_namespace('test-ns', value)) self.assertFalse(namespace.matches_template_namespace('fake', value))
def test_apply_template_namespace(self): namespaced = namespace.apply_template_namespace('test-ns', 'test-name') self.assertEqual(namespaced, 'test-ns::test-name') self.assertTrue( namespace.matches_template_namespace('test-ns', namespaced))
def test_apply_template_namespace(self): namespaced = namespace.apply_template_namespace('test-ns', 'test-name') self.assertEqual(namespaced, 'test-ns::test-name') self.assertTrue(namespace.matches_template_namespace('test-ns', namespaced))