def destroyDb(self, *a):
     sqlmanager.query(
         "DROP DATABASE IF EXISTS %s" % (config.test.mysql.database,),
         user=config.test.mysql.root_user.name,
         password=config.test.mysql.root_user.password,
         host=config.test.mysql.host,
     )
Exemplo n.º 2
0
    def setUp(self):
        self.settings = pokernetworkconfig.Config([])
        self.settings.doc = libxml2.parseMemory(settings_mysql_xml, len(settings_mysql_xml))
        self.settings.header = self.settings.doc.xpathNewContext()

        self.parameters = self.settings.headerGetProperties("/server/auth")[0]
        sqlmanager.query("DROP DATABASE IF EXISTS %s" % self.parameters["db"],
            user=config.test.mysql.root_user.name,
            password=config.test.mysql.root_user.password,
            host=config.test.mysql.host,
            port=config.test.mysql.port
        )
        self.db = MySQLdb.connect(
            host = self.parameters["host"],
            port = int(self.parameters.get("port", '3306')),
            user = self.parameters["user"],
            passwd = self.parameters["password"]
        )
        self.db.query("CREATE DATABASE %s" % self.parameters["db"])
        self.db.query("USE %s" % self.parameters["db"])
        self.db.query("CREATE TABLE %s (username varchar(20), password varchar(20), privilege int)" % self.parameters["table"])
        self.db.query("INSERT INTO users (username, password, privilege) VALUES ('testuser', 'testpassword', %i)" % User.REGULAR)
Exemplo n.º 3
0
 def destroyDb(self, *a):
     sqlmanager.query("DROP DATABASE IF EXISTS %s" %
                      (config.test.mysql.database, ),
                      user=config.test.mysql.root_user.name,
                      password=config.test.mysql.root_user.password,
                      host=config.test.mysql.host)