Beispiel #1
0
 def testConstructor_005(self):
     """
   Test assignment of capacity attribute, valid value.
   """
     config = LocalConfig()
     config.capacity = CapacityConfig()
     self.failUnlessEqual(CapacityConfig(), config.capacity)
Beispiel #2
0
 def testConstructor_008(self):
     """
   Test assignment of minBytes attribute, valid value.
   """
     capacity = CapacityConfig()
     self.failUnlessEqual(None, capacity.minBytes)
     capacity.minBytes = ByteQuantity("1.00", UNIT_KBYTES)
     self.failUnlessEqual(ByteQuantity("1.00", UNIT_KBYTES),
                          capacity.minBytes)
Beispiel #3
0
 def testConstructor_004(self):
     """
   Test assignment of maxPercentage attribute, valid value.
   """
     capacity = CapacityConfig()
     self.failUnlessEqual(None, capacity.maxPercentage)
     capacity.maxPercentage = PercentageQuantity("63.2")
     self.failUnlessEqual(PercentageQuantity("63.2"),
                          capacity.maxPercentage)
Beispiel #4
0
 def testComparison_005(self):
     """
   Test comparison of two differing objects, minBytes differs (one None).
   """
     capacity1 = CapacityConfig()
     capacity2 = CapacityConfig(minBytes=ByteQuantity("1.00", UNIT_MBYTES))
     self.failIfEqual(capacity1, capacity2)
     self.failUnless(not capacity1 == capacity2)
     self.failUnless(capacity1 < capacity2)
     self.failUnless(capacity1 <= capacity2)
     self.failUnless(not capacity1 > capacity2)
     self.failUnless(not capacity1 >= capacity2)
     self.failUnless(capacity1 != capacity2)
Beispiel #5
0
 def testComparison_003(self):
     """
   Test comparison of two differing objects, maxPercentage differs (one None).
   """
     capacity1 = CapacityConfig()
     capacity2 = CapacityConfig(maxPercentage=PercentageQuantity("63.2"))
     self.failIfEqual(capacity1, capacity2)
     self.failUnless(not capacity1 == capacity2)
     self.failUnless(capacity1 < capacity2)
     self.failUnless(capacity1 <= capacity2)
     self.failUnless(not capacity1 > capacity2)
     self.failUnless(not capacity1 >= capacity2)
     self.failUnless(capacity1 != capacity2)
Beispiel #6
0
 def testComparison_001(self):
     """
   Test comparison of two identical objects, all attributes None.
   """
     capacity1 = CapacityConfig()
     capacity2 = CapacityConfig()
     self.failUnlessEqual(capacity1, capacity2)
     self.failUnless(capacity1 == capacity2)
     self.failUnless(not capacity1 < capacity2)
     self.failUnless(capacity1 <= capacity2)
     self.failUnless(not capacity1 > capacity2)
     self.failUnless(capacity1 >= capacity2)
     self.failUnless(not capacity1 != capacity2)
Beispiel #7
0
 def testComparison_006(self):
     """
   Test comparison of two differing objects, minBytes differs.
   """
     capacity1 = CapacityConfig(PercentageQuantity("63.2"),
                                ByteQuantity("0.5", UNIT_MBYTES))
     capacity2 = CapacityConfig(PercentageQuantity("63.2"),
                                ByteQuantity("1.00", UNIT_MBYTES))
     self.failIfEqual(capacity1, capacity2)
     self.failUnless(not capacity1 == capacity2)
     self.failUnless(capacity1 < capacity2)
     self.failUnless(capacity1 <= capacity2)
     self.failUnless(not capacity1 > capacity2)
     self.failUnless(not capacity1 >= capacity2)
     self.failUnless(capacity1 != capacity2)
Beispiel #8
0
 def testComparison_002(self):
     """
   Test comparison of two identical objects, all attributes non-None.
   """
     capacity1 = CapacityConfig(PercentageQuantity("63.2"),
                                ByteQuantity("1.00", UNIT_MBYTES))
     capacity2 = CapacityConfig(PercentageQuantity("63.2"),
                                ByteQuantity("1.00", UNIT_MBYTES))
     self.failUnlessEqual(capacity1, capacity2)
     self.failUnless(capacity1 == capacity2)
     self.failUnless(not capacity1 < capacity2)
     self.failUnless(capacity1 <= capacity2)
     self.failUnless(not capacity1 > capacity2)
     self.failUnless(capacity1 >= capacity2)
     self.failUnless(not capacity1 != capacity2)
Beispiel #9
0
 def testConstructor_001(self):
     """
   Test constructor with no values filled in.
   """
     capacity = CapacityConfig()
     self.failUnlessEqual(None, capacity.maxPercentage)
     self.failUnlessEqual(None, capacity.minBytes)
Beispiel #10
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.failUnlessRaises(ValueError, config.validate)
Beispiel #11
0
 def testValidate_002(self):
     """
   Test validate on an empty capacity section.
   """
     config = LocalConfig()
     config.capacity = CapacityConfig()
     self.failUnlessRaises(ValueError, config.validate)
Beispiel #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.failUnlessEqual(config1, config2)
        self.failUnless(config1 == config2)
        self.failUnless(not config1 < config2)
        self.failUnless(config1 <= config2)
        self.failUnless(not config1 > config2)
        self.failUnless(config1 >= config2)
        self.failUnless(not config1 != config2)
Beispiel #13
0
 def testConstructor_010(self):
     """
   Test assignment of minBytes attribute, invalid value (not a ByteQuantity).
   """
     capacity = CapacityConfig()
     self.failUnlessEqual(None, capacity.minBytes)
     self.failUnlessAssignRaises(ValueError, capacity, "minBytes", 12)
     self.failUnlessEqual(None, capacity.minBytes)
Beispiel #14
0
 def testConstructor_005(self):
     """
   Test assignment of maxPercentage attribute, invalid value (empty).
   """
     capacity = CapacityConfig()
     self.failUnlessEqual(None, capacity.maxPercentage)
     self.failUnlessAssignRaises(ValueError, capacity, "maxPercentage", "")
     self.failUnlessEqual(None, capacity.maxPercentage)
Beispiel #15
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)
Beispiel #16
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()
Beispiel #17
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)
Beispiel #18
0
 def testAddConfig_001(self):
     """
   Test with empty config document.
   """
     capacity = CapacityConfig()
     config = LocalConfig()
     config.capacity = capacity
     self.validateAddConfig(config)
Beispiel #19
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()
Beispiel #20
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.failUnlessRaises(ValueError, config.validate)
Beispiel #21
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)
Beispiel #22
0
 def testConstructor_002(self):
     """
   Test constructor with all values filled in, with valid values.
   """
     capacity = CapacityConfig(PercentageQuantity("63.2"),
                               ByteQuantity("2.0", UNIT_KBYTES))
     self.failUnlessEqual(PercentageQuantity("63.2"),
                          capacity.maxPercentage)
     self.failUnlessEqual(ByteQuantity("2.0", UNIT_KBYTES),
                          capacity.minBytes)
Beispiel #23
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.failIfEqual(config1, config2)
        self.failUnless(not config1 == config2)
        self.failUnless(config1 < config2)
        self.failUnless(config1 <= config2)
        self.failUnless(not config1 > config2)
        self.failUnless(not config1 >= config2)
        self.failUnless(config1 != config2)
Beispiel #24
0
 def testStringFuncs_001(self):
     """
   Just make sure that the string functions don't have errors (i.e. bad variable names).
   """
     obj = CapacityConfig()
     obj.__repr__()
     obj.__str__()
Beispiel #25
0
 def testComparison_003(self):
     """
   Test comparison of two differing objects, capacity differs (one None).
   """
     config1 = LocalConfig()
     config2 = LocalConfig()
     config2.capacity = CapacityConfig()
     self.failIfEqual(config1, config2)
     self.failUnless(not config1 == config2)
     self.failUnless(config1 < config2)
     self.failUnless(config1 <= config2)
     self.failUnless(not config1 > config2)
     self.failUnless(not config1 >= config2)
     self.failUnless(config1 != config2)