示例#1
0
 def show_databases(self, user, password):
     print("Going to connect to %s, %s, %s"
           % (instance_info.get_address(), user, password))
     with util.mysql_connection().create(instance_info.get_address(),
                                         user, password) as db:
         print(db)
         dbs = db.execute("show databases")
         return [row['Database'] for row in dbs]
示例#2
0
    def _check_mysql_connection(self, username, password, success=True):
        # This can only test connections for users with the host %.
        # Much more difficult to simulate connection attempts from other hosts.
        if FAKE:
            # "Fake mode; cannot test mysql connection."
            return

        conn = util.mysql_connection()
        if success:
            conn.create(username, password, instance_info.get_address())
        else:
            conn.assert_fails(username, password, instance_info.get_address())
示例#3
0
    def _check_mysql_connection(self, username, password, success=True):
        # This can only test connections for users with the host %.
        # Much more difficult to simulate connection attempts from other hosts.
        if FAKE:
            # "Fake mode; cannot test mysql connection."
            return

        conn = util.mysql_connection()
        if success:
            conn.create(username, password, instance_info.get_address())
        else:
            conn.assert_fails(username, password, instance_info.get_address())
示例#4
0
 def _check_connection(self, username, password):
     if not FAKE:
         util.mysql_connection().assert_fails(username, password,
                                              instance_info.get_address())
     # Also determine the db is gone via API.
     result = self.dbaas.users.list(instance_info.id)
     assert_equal(200, self.dbaas.last_http_code)
     for item in result:
         if item.name == username:
             fail("User %s was not deleted." % username)
示例#5
0
 def test_mysql_root(self):
     """Ensure we aren't allowed access with root and wrong password."""
     assert_mysql_connection_fails("root", "dsfgnear",
                                   instance_info.get_address())
示例#6
0
 def test_mysql_admin(self):
     """Ensure we aren't allowed access with os_admin and wrong password."""
     assert_mysql_connection_fails("os_admin", "asdfd-asdf234",
                                   instance_info.get_address())
示例#7
0
文件: root.py 项目: juicegit/reddwarf
def log_in_as_root(root_password):
    con = create_mysql_connection(instance_info.get_address(), "root", root_password)
    return con
示例#8
0
def log_in_as_root(root_password):
    con = create_mysql_connection(instance_info.get_address(), 'root',
                                  root_password)
    return con
示例#9
0
 def set_up(self):
     """If you're using this as a base class, call this method first."""
     self.dbaas = instance_info.dbaas
     if USE_IP:
         address = instance_info.get_address()
         self.connection = MySqlConnection(address)
示例#10
0
 def instance_address(self):
     return instance_info.get_address()
示例#11
0
 def test_mysql_root(self):
     """Ensure we aren't allowed access with root and wrong password."""
     util.mysql_connection().assert_fails("root", "dsfgnear",
                                          instance_info.get_address())
示例#12
0
 def test_mysql_admin(self):
     """Ensure we aren't allowed access with os_admin and wrong password."""
     util.mysql_connection().assert_fails("os_admin", "asdfd-asdf234",
                                          instance_info.get_address())
示例#13
0
 def set_up(self):
     """If you're using this as a base class, call this method first."""
     self.dbaas = instance_info.dbaas
     if USE_IP:
         address = instance_info.get_address()
         self.connection = MySqlConnection(address)
示例#14
0
 def instance_address(self):
     return instance_info.get_address()