Exemple #1
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)
Exemple #2
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]
Exemple #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())
Exemple #4
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())
Exemple #5
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())
Exemple #6
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())
Exemple #7
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())
Exemple #8
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())