def test_namespace06(self): ''' ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name, foo={'value': 5}, bar=7) self.assertFalse(cr.has_property('Idonotexist'))
def test_namespace01(self): ''' ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name) self.assertEqual(cr.name, name)
def test_namespace08(self): ''' ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name) cr.add_properties(properties={'foo': {'value': 5}, 'bar': 7}) self.assertEqual(cr.foo.value, 5)
def test_namespace07(self): ''' ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name, foo={'value': 5}, bar=7) cr.add_property('baz', value=9) self.assertEqual(cr.baz.value, 9)
def test_namespace03(self): ''' ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name, foo={'value': 5}, bar=7) self.assertEqual(cr.name, name) self.assertEqual(cr.foo.name, 'foo') self.assertEqual(cr.foo.value, 5)
def test_namespace13(self): ''' ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name, foo={'value': 5}, bar=7) eok = False try: cr.add_properties(properties={'foo': {'value': 5}}) except ConfigNamespaceDuplicateProperty: eok = True self.assertTrue(eok)
def test_namespace12(self): ''' ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name) eok = False try: cr.add_properties(properties={'foo': {'value': 5}, '!badname': 7}) except ConfigPropertyBadName: eok = True self.assertTrue(eok)
def test_namespace09(self): ''' ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name) cr.add_properties(properties={'foo': {'value': 5}, 'bar': 7}) act = "%r" % (cr, ) log.debug("(1) ACTUAL=" + act) exp = ("ConfigNamespace(bar=<class " "'dlapp.configuration.ConfigPropertyRecordExt'>(bar , 7 ," " callback=None , validate=None), foo=<class " "'dlapp.configuration.ConfigPropertyRecordExt'>(foo , 5 ," " callback=None , validate=None), name='foo')") self.assertEqual(act, exp)
def test_namespace04(self): ''' Clear the singleton configuration manager. Get a configuration namespace (triggering instantiation of a new configuration manager). Use the add_properties() interface. Test the correct properties were added. ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = 'foo' cr = configuration.ConfigNamespace(name, foo={'value': 5}, bar=7) eok = False try: cr.has_property('!bad') except ConfigPropertyBadName: eok = True self.assertTrue(eok)
def test_namespace02(self): ''' Clear the singleton configuration manager. Get a configuration namespace (triggering instantiation of a new configuration manager). Add a property record without value, callable or validate arguments. Test the exception raised when a configuration record value is unset and the value is read. ''' log = logging.getLogger(__name__) log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self)) name = '!badname' eok = False try: configuration.ConfigNamespace(name) except ConfigNamespaceBadName: eok = True self.assertTrue(eok)