コード例 #1
0
 def testComparison_016(self):
     """
   Test comparison of two differing objects, databases differs (both not empty).
   """
     mysql1 = MysqlConfig("user", "password", "gzip", True, [
         "whatever",
     ])
     mysql2 = MysqlConfig("user", "password", "gzip", True, [
         "whatever",
         "bogus",
     ])
     self.failIfEqual(mysql1, mysql2)
     self.failUnless(not mysql1 == mysql2)
     self.failUnless(
         not mysql1 <
         mysql2)  # note: different than standard due to unsorted list
     self.failUnless(
         not mysql1 <=
         mysql2)  # note: different than standard due to unsorted list
     self.failUnless(
         mysql1 >
         mysql2)  # note: different than standard due to unsorted list
     self.failUnless(
         mysql1 >=
         mysql2)  # note: different than standard due to unsorted list
     self.failUnless(mysql1 != mysql2)
コード例 #2
0
 def testConstructor_005(self):
     """
   Test assignment of mysql attribute, valid value.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig()
     self.failUnlessEqual(MysqlConfig(), config.mysql)
コード例 #3
0
 def testConstructor_016(self):
     """
   Test assignment of all attribute, None value.
   """
     mysql = MysqlConfig(all=True)
     self.failUnlessEqual(True, mysql.all)
     mysql.all = None
     self.failUnlessEqual(False, mysql.all)
コード例 #4
0
 def testConstructor_012(self):
     """
   Test assignment of compressMode attribute, None value.
   """
     mysql = MysqlConfig(compressMode="none")
     self.failUnlessEqual("none", mysql.compressMode)
     mysql.compressMode = None
     self.failUnlessEqual(None, mysql.compressMode)
コード例 #5
0
 def testConstructor_010(self):
     """
   Test assignment of password attribute, valid value.
   """
     mysql = MysqlConfig()
     self.failUnlessEqual(None, mysql.password)
     mysql.password = "******"
     self.failUnlessEqual("password", mysql.password)
コード例 #6
0
 def testConstructor_009(self):
     """
   Test assignment of password attribute, None value.
   """
     mysql = MysqlConfig(password="******")
     self.failUnlessEqual("password", mysql.password)
     mysql.password = None
     self.failUnlessEqual(None, mysql.password)
コード例 #7
0
 def testConstructor_007(self):
     """
   Test assignment of user attribute, valid value.
   """
     mysql = MysqlConfig()
     self.failUnlessEqual(None, mysql.user)
     mysql.user = "******"
     self.failUnlessEqual("user", mysql.user)
コード例 #8
0
 def testConstructor_020(self):
     """
   Test assignment of databases attribute, [] value.
   """
     mysql = MysqlConfig()
     self.failUnlessEqual(None, mysql.databases)
     mysql.databases = []
     self.failUnlessEqual([], mysql.databases)
コード例 #9
0
 def testConstructor_017(self):
     """
   Test assignment of all attribute, valid value (real boolean).
   """
     mysql = MysqlConfig()
     self.failUnlessEqual(False, mysql.all)
     mysql.all = True
     self.failUnlessEqual(True, mysql.all)
     mysql.all = False
     self.failUnlessEqual(False, mysql.all)
コード例 #10
0
 def testConstructor_013(self):
     """
   Test assignment of compressMode attribute, valid value.
   """
     mysql = MysqlConfig()
     self.failUnlessEqual(None, mysql.compressMode)
     mysql.compressMode = "none"
     self.failUnlessEqual("none", mysql.compressMode)
     mysql.compressMode = "gzip"
     self.failUnlessEqual("gzip", mysql.compressMode)
     mysql.compressMode = "bzip2"
     self.failUnlessEqual("bzip2", mysql.compressMode)
コード例 #11
0
 def testComparison_005(self):
     """
   Test comparison of two differing objects, user differs (one None).
   """
     mysql1 = MysqlConfig()
     mysql2 = MysqlConfig(user="******")
     self.failIfEqual(mysql1, mysql2)
     self.failUnless(not mysql1 == mysql2)
     self.failUnless(mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(not mysql1 >= mysql2)
     self.failUnless(mysql1 != mysql2)
コード例 #12
0
 def testComparison_003(self):
     """
   Test comparison of two identical objects, all attributes non-None, list empty.
   """
     mysql1 = MysqlConfig("user", "password", "bzip2", True, [])
     mysql2 = MysqlConfig("user", "password", "bzip2", True, [])
     self.failUnlessEqual(mysql1, mysql2)
     self.failUnless(mysql1 == mysql2)
     self.failUnless(not mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(mysql1 >= mysql2)
     self.failUnless(not mysql1 != mysql2)
コード例 #13
0
 def testComparison_001(self):
     """
   Test comparison of two identical objects, all attributes None.
   """
     mysql1 = MysqlConfig()
     mysql2 = MysqlConfig()
     self.failUnlessEqual(mysql1, mysql2)
     self.failUnless(mysql1 == mysql2)
     self.failUnless(not mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(mysql1 >= mysql2)
     self.failUnless(not mysql1 != mysql2)
コード例 #14
0
 def testComparison_007(self):
     """
   Test comparison of two differing objects, password differs (one None).
   """
     mysql1 = MysqlConfig()
     mysql2 = MysqlConfig(password="******")
     self.failIfEqual(mysql1, mysql2)
     self.failUnless(not mysql1 == mysql2)
     self.failUnless(mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(not mysql1 >= mysql2)
     self.failUnless(mysql1 != mysql2)
コード例 #15
0
 def testComparison_013(self):
     """
   Test comparison of two differing objects, databases differs (one None, one empty).
   """
     mysql1 = MysqlConfig()
     mysql2 = MysqlConfig(databases=[])
     self.failIfEqual(mysql1, mysql2)
     self.failUnless(not mysql1 == mysql2)
     self.failUnless(mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(not mysql1 >= mysql2)
     self.failUnless(mysql1 != mysql2)
コード例 #16
0
 def testComparison_009(self):
     """
   Test comparison of two differing objects, compressMode differs (one None).
   """
     mysql1 = MysqlConfig()
     mysql2 = MysqlConfig(compressMode="gzip")
     self.failIfEqual(mysql1, mysql2)
     self.failUnless(not mysql1 == mysql2)
     self.failUnless(mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(not mysql1 >= mysql2)
     self.failUnless(mysql1 != mysql2)
コード例 #17
0
 def testComparison_011(self):
     """
   Test comparison of two differing objects, all differs (one None).
   """
     mysql1 = MysqlConfig()
     mysql2 = MysqlConfig(all=True)
     self.failIfEqual(mysql1, mysql2)
     self.failUnless(not mysql1 == mysql2)
     self.failUnless(mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(not mysql1 >= mysql2)
     self.failUnless(mysql1 != mysql2)
コード例 #18
0
 def testComparison_015(self):
     """
   Test comparison of two differing objects, databases differs (one empty, one not empty).
   """
     mysql1 = MysqlConfig("user", "password", "gzip", True, [])
     mysql2 = MysqlConfig("user", "password", "gzip", True, [
         "whatever",
     ])
     self.failIfEqual(mysql1, mysql2)
     self.failUnless(not mysql1 == mysql2)
     self.failUnless(mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(not mysql1 >= mysql2)
     self.failUnless(mysql1 != mysql2)
コード例 #19
0
 def testAddConfig_004(self):
     """
   Test with no databases, all other values filled in, all=False.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig("user", "password", "gzip", False, None)
     self.validateAddConfig(config)
コード例 #20
0
 def testValidate_011(self):
     """
   Test validate on a non-empty mysql section, with user=None and password=None.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig(None, None, "gzip", True, None)
     config.validate()
コード例 #21
0
 def testAddConfig_003(self):
     """
   Test with no databases, all other values filled in, all=True.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig("user", "password", "none", True, None)
     self.validateAddConfig(config)
コード例 #22
0
 def testValidate_006(self):
     """
   Test validate on a non-empty mysql section, all=False, databases=None.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig("user", "password", "gzip", False, None)
     self.failUnlessRaises(ValueError, config.validate)
コード例 #23
0
 def testValidate_007(self):
     """
   Test validate on a non-empty mysql section, all=False, empty databases.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig("user", "password", "bzip2", False, [])
     self.failUnlessRaises(ValueError, config.validate)
コード例 #24
0
 def testValidate_003(self):
     """
   Test validate on a non-empty mysql section, all=True, databases=None.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig("user", "password", "gzip", True, None)
     config.validate()
コード例 #25
0
 def testValidate_004(self):
     """
   Test validate on a non-empty mysql section, all=True, empty databases.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig("user", "password", "none", True, [])
     config.validate()
コード例 #26
0
 def testValidate_002(self):
     """
   Test validate on an empty mysql section.
   """
     config = LocalConfig()
     config.mysql = MysqlConfig()
     self.failUnlessRaises(ValueError, config.validate)
コード例 #27
0
    def testComparison_004(self):
        """
      Test comparison of two differing objects, mysql differs.
      """
        config1 = LocalConfig()
        config1.mysql = MysqlConfig(user="******")

        config2 = LocalConfig()
        config2.mysql = MysqlConfig(user="******")

        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)
コード例 #28
0
    def testComparison_002(self):
        """
      Test comparison of two identical objects, all attributes non-None.
      """
        config1 = LocalConfig()
        config1.mysql = MysqlConfig()

        config2 = LocalConfig()
        config2.mysql = MysqlConfig()

        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)
コード例 #29
0
 def testConstructor_021(self):
     """
   Test assignment of databases attribute, single valid entry.
   """
     mysql = MysqlConfig()
     self.failUnlessEqual(None, mysql.databases)
     mysql.databases = [
         "/whatever",
     ]
     self.failUnlessEqual([
         "/whatever",
     ], mysql.databases)
     mysql.databases.append("/stuff")
     self.failUnlessEqual([
         "/whatever",
         "/stuff",
     ], mysql.databases)
コード例 #30
0
 def testComparison_012(self):
     """
   Test comparison of two differing objects, all differs.
   """
     mysql1 = MysqlConfig("user", "password", "gzip", False, [
         "whatever",
     ])
     mysql2 = MysqlConfig("user", "password", "gzip", True, [
         "whatever",
     ])
     self.failIfEqual(mysql1, mysql2)
     self.failUnless(not mysql1 == mysql2)
     self.failUnless(mysql1 < mysql2)
     self.failUnless(mysql1 <= mysql2)
     self.failUnless(not mysql1 > mysql2)
     self.failUnless(not mysql1 >= mysql2)
     self.failUnless(mysql1 != mysql2)