예제 #1
0
 def testValidate_003(self):
     """
     Test validate on a non-empty capacity section with no values filled in.
     """
     config = LocalConfig()
     config.capacity = CapacityConfig(None, None)
     self.assertRaises(ValueError, config.validate)
예제 #2
0
 def testValidate_001(self):
     """
     Test validate on a None capacity section.
     """
     config = LocalConfig()
     config.capacity = None
     self.assertRaises(ValueError, config.validate)
예제 #3
0
 def testValidate_002(self):
     """
     Test validate on an empty capacity section.
     """
     config = LocalConfig()
     config.capacity = CapacityConfig()
     self.assertRaises(ValueError, config.validate)
예제 #4
0
 def testConstructor_005(self):
     """
     Test assignment of capacity attribute, valid value.
     """
     config = LocalConfig()
     config.capacity = CapacityConfig()
     self.assertEqual(CapacityConfig(), config.capacity)
예제 #5
0
 def testConstructor_004(self):
     """
     Test assignment of capacity attribute, None value.
     """
     config = LocalConfig()
     config.capacity = None
     self.assertEqual(None, config.capacity)
예제 #6
0
 def testAddConfig_006(self):
     """
     Test with min bytes value set, GB values.
     """
     capacity = CapacityConfig(minBytes=ByteQuantity("63352", UNIT_GBYTES))
     config = LocalConfig()
     config.capacity = capacity
     self.validateAddConfig(config)
예제 #7
0
 def testAddConfig_003(self):
     """
     Test with min bytes value set, byte values.
     """
     capacity = CapacityConfig(minBytes=ByteQuantity("121231", UNIT_BYTES))
     config = LocalConfig()
     config.capacity = capacity
     self.validateAddConfig(config)
예제 #8
0
 def testAddConfig_001(self):
     """
     Test with empty config document.
     """
     capacity = CapacityConfig()
     config = LocalConfig()
     config.capacity = capacity
     self.validateAddConfig(config)
예제 #9
0
 def testValidate_006(self):
     """
     Test validate on a non-empty capacity section with only min bytes filled in.
     """
     config = LocalConfig()
     config.capacity = CapacityConfig(
         minBytes=ByteQuantity("1.00", UNIT_MBYTES))
     config.validate()
예제 #10
0
 def testValidate_005(self):
     """
     Test validate on a non-empty capacity section with only max percentage filled in.
     """
     config = LocalConfig()
     config.capacity = CapacityConfig(
         maxPercentage=PercentageQuantity("63.2"))
     config.validate()
예제 #11
0
 def testValidate_004(self):
     """
     Test validate on a non-empty capacity section with both max percentage and min bytes filled in.
     """
     config = LocalConfig()
     config.capacity = CapacityConfig(PercentageQuantity("63.2"),
                                      ByteQuantity("1.00", UNIT_MBYTES))
     self.assertRaises(ValueError, config.validate)
예제 #12
0
    def testComparison_002(self):
        """
        Test comparison of two identical objects, all attributes non-None.
        """
        config1 = LocalConfig()
        config1.capacity = CapacityConfig()

        config2 = LocalConfig()
        config2.capacity = CapacityConfig()

        self.assertEqual(config1, config2)
        self.assertTrue(config1 == config2)
        self.assertTrue(not config1 < config2)
        self.assertTrue(config1 <= config2)
        self.assertTrue(not config1 > config2)
        self.assertTrue(config1 >= config2)
        self.assertTrue(not config1 != config2)
예제 #13
0
 def testAddConfig_002(self):
     """
     Test with max percentage value set.
     """
     capacity = CapacityConfig(
         maxPercentage=PercentageQuantity("63.29128310980123"))
     config = LocalConfig()
     config.capacity = capacity
     self.validateAddConfig(config)
예제 #14
0
    def testComparison_004(self):
        """
        Test comparison of two differing objects, capacity differs.
        """
        config1 = LocalConfig()
        config1.capacity = CapacityConfig(
            minBytes=ByteQuantity("0.1", UNIT_MBYTES))

        config2 = LocalConfig()
        config2.capacity = CapacityConfig(
            minBytes=ByteQuantity("1.00", UNIT_MBYTES))

        self.assertNotEqual(config1, config2)
        self.assertTrue(not config1 == config2)
        self.assertTrue(config1 < config2)
        self.assertTrue(config1 <= config2)
        self.assertTrue(not config1 > config2)
        self.assertTrue(not config1 >= config2)
        self.assertTrue(config1 != config2)
예제 #15
0
 def testComparison_003(self):
     """
     Test comparison of two differing objects, capacity differs (one None).
     """
     config1 = LocalConfig()
     config2 = LocalConfig()
     config2.capacity = CapacityConfig()
     self.assertNotEqual(config1, config2)
     self.assertTrue(not config1 == config2)
     self.assertTrue(config1 < config2)
     self.assertTrue(config1 <= config2)
     self.assertTrue(not config1 > config2)
     self.assertTrue(not config1 >= config2)
     self.assertTrue(config1 != config2)