Exemplo n.º 1
0
 def testConstructor_012f(self):
     """
   Test assignment of fullBackupSizeLimit attribute, valid byte quantity value.
   """
     amazons3 = AmazonS3Config()
     self.failUnlessEqual(None, amazons3.fullBackupSizeLimit)
     amazons3.fullBackupSizeLimit = ByteQuantity(600, UNIT_MBYTES)
     self.failUnlessEqual(ByteQuantity(600, UNIT_MBYTES),
                          amazons3.fullBackupSizeLimit)
     self.failUnlessEqual(629145600.0, amazons3.fullBackupSizeLimit.bytes)
Exemplo n.º 2
0
 def testConstructor_015e(self):
     """
   Test assignment of incrementalBackupSizeLimit attribute, valid byte quantity value.
   """
     amazons3 = AmazonS3Config()
     self.failUnlessEqual(None, amazons3.incrementalBackupSizeLimit)
     amazons3.incrementalBackupSizeLimit = ByteQuantity(2.5, UNIT_GBYTES)
     self.failUnlessEqual(ByteQuantity(2.5, UNIT_GBYTES),
                          amazons3.incrementalBackupSizeLimit)
     self.failUnlessEqual(2684354560.0,
                          amazons3.incrementalBackupSizeLimit.bytes)
Exemplo n.º 3
0
 def testConstructor_002b(self):
     """
   Test constructor with all values filled in, with valid values (byte quantities).
   """
     amazons3 = AmazonS3Config(True, "bucket", "encrypt",
                               ByteQuantity(1, UNIT_BYTES),
                               ByteQuantity(2, UNIT_BYTES))
     self.failUnlessEqual(True, amazons3.warnMidnite)
     self.failUnlessEqual("bucket", amazons3.s3Bucket)
     self.failUnlessEqual("encrypt", amazons3.encryptCommand)
     self.failUnlessEqual(ByteQuantity(1, UNIT_BYTES),
                          amazons3.fullBackupSizeLimit)
     self.failUnlessEqual(ByteQuantity(2, UNIT_BYTES),
                          amazons3.incrementalBackupSizeLimit)
Exemplo n.º 4
0
 def testConstructor_015d(self):
     """
   Test assignment of incrementalBackupSizeLimit attribute, valid string value.
   """
     amazons3 = AmazonS3Config()
     self.failUnlessEqual(None, amazons3.incrementalBackupSizeLimit)
     amazons3.incrementalBackupSizeLimit = "7516192768"
     self.failUnlessEqual(7516192768, amazons3.incrementalBackupSizeLimit)
     self.failUnlessEqual(ByteQuantity("7516192768", UNIT_BYTES),
                          amazons3.incrementalBackupSizeLimit)
Exemplo n.º 5
0
 def testConstructor_015a(self):
     """
   Test assignment of incrementalBackupSizeLimit attribute, valid int value.
   """
     amazons3 = AmazonS3Config()
     self.failUnlessEqual(None, amazons3.incrementalBackupSizeLimit)
     amazons3.incrementalBackupSizeLimit = 15
     self.failUnlessEqual(15, amazons3.incrementalBackupSizeLimit)
     self.failUnlessEqual(ByteQuantity(15, UNIT_BYTES),
                          amazons3.incrementalBackupSizeLimit)
Exemplo n.º 6
0
 def testConstructor_012c(self):
     """
   Test assignment of fullBackupSizeLimit attribute, valid float value.
   """
     amazons3 = AmazonS3Config()
     self.failUnlessEqual(None, amazons3.fullBackupSizeLimit)
     amazons3.fullBackupSizeLimit = 7516192768.0
     self.failUnlessEqual(7516192768.0, amazons3.fullBackupSizeLimit)
     self.failUnlessEqual(ByteQuantity(7516192768.0, UNIT_BYTES),
                          amazons3.fullBackupSizeLimit)
Exemplo n.º 7
0
 def _setFullBackupSizeLimit(self, value):
     """
   Property target used to set the full backup size limit.
   The value must be an integer >= 0.
   @raise ValueError: If the value is not valid.
   """
     if value is None:
         self._fullBackupSizeLimit = None
     else:
         if isinstance(value, ByteQuantity):
             self._fullBackupSizeLimit = value
         else:
             self._fullBackupSizeLimit = ByteQuantity(value, UNIT_BYTES)
Exemplo n.º 8
0
 def testParse_003(self):
     """
   Parse config document with filled-in values.
   """
     path = self.resources["amazons3.conf.3"]
     contents = open(path).read()
     config = LocalConfig(xmlPath=path, validate=False)
     self.failIfEqual(None, config.amazons3)
     self.failUnlessEqual(True, config.amazons3.warnMidnite)
     self.failUnlessEqual("mybucket", config.amazons3.s3Bucket)
     self.failUnlessEqual("encrypt", config.amazons3.encryptCommand)
     self.failUnlessEqual(ByteQuantity(2.5, UNIT_GBYTES),
                          config.amazons3.fullBackupSizeLimit)
     self.failUnlessEqual(ByteQuantity(600, UNIT_MBYTES),
                          config.amazons3.incrementalBackupSizeLimit)
     config = LocalConfig(xmlData=contents, validate=False)
     self.failIfEqual(None, config.amazons3)
     self.failUnlessEqual(True, config.amazons3.warnMidnite)
     self.failUnlessEqual("mybucket", config.amazons3.s3Bucket)
     self.failUnlessEqual("encrypt", config.amazons3.encryptCommand)
     self.failUnlessEqual(ByteQuantity(2.5, UNIT_GBYTES),
                          config.amazons3.fullBackupSizeLimit)
     self.failUnlessEqual(ByteQuantity(600, UNIT_MBYTES),
                          config.amazons3.incrementalBackupSizeLimit)