def test_validate_bad_formats(self): invalid_test_cases = [ None, '', 'too.many.periods', 'bad.namespace', ' prewhitespace', 'postwhitespace ', 'inner whitespace', ] for invalid in invalid_test_cases: with self.assertRaises(InvalidParameterException): parse_param(invalid)
def test_validate_bad_formats(self): invalid_test_cases = [ None, '', 'too.many.periods', 'bad.namespace', ' prewhitespace', 'postwhitespace ', 'inner whitespace', ] for invalid in invalid_test_cases: with self.assertRaises(InvalidParameterException): parse_param(invalid) if invalid: with self.assertRaises(InvalidParameterException): template = 'Hello {%s}' % invalid PerformanceConfiguration(template=template).validate()
def test_default_namespace(self): parsed = parse_param('variable_name') self.assertEqual(GLOBAL_NAMESPACE, parsed.namespace) self.assertEqual('variable_name', parsed.variable)
def test_valid_namespaces(self): for namespace in VALID_NAMESPACES: unparsed = '{}.variable_name'.format(namespace) parsed = parse_param(unparsed) self.assertEqual(namespace, parsed.namespace) self.assertEqual('variable_name', parsed.variable)