예제 #1
0
 def test_propertyrecord01(self):
     '''
     Create property record, verify the name and value.
     '''
     log = logging.getLogger(__name__)
     log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self))
     name = 'foo'
     val = 7
     cr = configuration.ConfigPropertyRecord(name, value=val)
     self.assertEqual(cr.name, name)
     self.assertEqual(cr.value, val)
예제 #2
0
 def test_propertyrecord05(self):
     '''
     Create a property. Set then test a new name.
     '''
     log = logging.getLogger(__name__)
     log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self))
     name = 'foo'
     val = 7
     cr = configuration.ConfigPropertyRecord(name, value=val)
     cr.name = 'bar'
     self.assertEqual(cr.name, 'bar')
     self.assertEqual(cr.value, val)
예제 #3
0
    def test_propertyrecord03(self):
        '''
        Create property record and check it is serialized (repr) correctly.
        '''
        log = logging.getLogger(__name__)
        log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self))
        name = 'foo'
        val = 7
        cr = configuration.ConfigPropertyRecord(name, value=val)
        act = "%r" % (cr,)

        exp = "<class 'dlapp.configuration.ConfigPropertyRecord'>(foo , 7)"
        self.assertEqual(act, exp)
예제 #4
0
 def test_propertyrecord07(self):
     '''
     Create a property with a value.  Change the value and test the
     returned value is correct.
     '''
     log = logging.getLogger(__name__)
     log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self))
     name = 'foo'
     val = 7
     cr = configuration.ConfigPropertyRecord(name, value=val)
     cr.value = 3
     self.assertEqual(cr.name, name)
     self.assertEqual(cr.value, 3)
예제 #5
0
 def test_propertyrecord04(self):
     '''
     Create property record without a value and check it is serialized
     (repr) correctly.
     '''
     log = logging.getLogger(__name__)
     log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self))
     name = 'foo'
     cr = configuration.ConfigPropertyRecord(name)
     act = "%r" % (cr,)
     exp = ("<class 'dlapp.configuration.ConfigPropertyRecord'>(foo"
            " , '(unset)')")
     self.assertEqual(act, exp)
예제 #6
0
 def test_propertyrecord06(self):
     '''
     Create a property. Try to set a bad name, test the exception raised.
     '''
     log = logging.getLogger(__name__)
     log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self))
     name = 'foo'
     cr = configuration.ConfigPropertyRecord(name)
     eok = False
     try:
         cr.name = "!badname"
     except ConfigPropertyBadName:
         eok = True
     self.assertTrue(eok)
예제 #7
0
 def test_propertyrecord02(self):
     '''
     Create property record without a value.  Confirm correct exception
     is raised if the unset value is accessed.
     '''
     log = logging.getLogger(__name__)
     log.debug("BEGIN: unittest.TestCase.id=%r", unittest.TestCase.id(self))
     name = 'foo'
     cr = configuration.ConfigPropertyRecord(name)
     eok = False
     try:
         cr.value
     except ConfigPropertyValueNotSet:
         eok = True
     self.assertTrue(eok)