Beispiel #1
0
    def setUp(self):
        self.server_id = parent_node_dict["server"][-1]["server_id"]

        self.data = self.test_data

        self.role_name = "role_get_%s" % str(uuid.uuid4())[1:8]
        self.role_id = roles_utils.create_role(self.server, self.role_name)

        role_dict = {
            "server_id": self.server_id,
            "role_id": self.role_id,
            "role_name": self.role_name,
            "new_role_name": None
        }

        self.data['did'] = parent_node_dict['database'][-1]['db_id']

        if self.data["role_op"] == 'reassign':

            if hasattr(self, 'server_min_version') and \
                self.server_information['server_version'] \
                    < self.server_min_version:
                self.skipTest(self.skip_msg)

            self.role_name_1 = "role_get_%s" % str(uuid.uuid4())[1:8]
            self.role_id_1 = roles_utils.create_role(self.server,
                                                     self.role_name_1)
            role_dict["role_id_1"] = self.role_id_1
            role_dict["new_role_name"] = self.role_name_1

            self.data["new_role_id"] = self.role_id_1
            self.data["new_role_name"] = self.role_name_1

        utils.write_node_info("lrid", role_dict)
Beispiel #2
0
 def setUp(self):
     self.db_name = "test_db_put_%s" % str(uuid.uuid4())[1:8]
     self.db_id = utils.create_database(self.server, self.db_name)
     self.server_id = parent_node_dict["server"][-1]["server_id"]
     db_dict = {"server_id": self.server_id, "db_id": self.db_id,
                "db_name": self.db_name}
     utils.write_node_info("did", db_dict)
Beispiel #3
0
 def setUp(self):
     self.db_name = "db_delete_%s" % str(uuid.uuid4())[1:8],
     self.db_id = utils.create_database(self.server, self.db_name)
     self.server_id = parent_node_dict["server"][-1]["server_id"]
     db_dict = {"server_id": self.server_id, "db_id": self.db_id,
                "db_name": self.db_name}
     utils.write_node_info("did", db_dict)
Beispiel #4
0
 def setUp(self):
     self.role_name = "role_delete_%s" % str(uuid.uuid4())[1:8]
     self.role_id = roles_utils.create_role(self.server, self.role_name)
     self.server_id = parent_node_dict["server"][-1]["server_id"]
     role_dict = {"server_id": self.server_id, "role_id": self.role_id,
                  "role_name": self.role_name}
     utils.write_node_info("lrid", role_dict)
 def runTest(self):
     """ This function will add database under 1st server of tree node. """
     self.db_name = ''
     self.server_id = parent_node_dict["server"][-1]["server_id"]
     server_response = server_utils.connect_server(self, self.server_id)
     if server_response["info"] == "Server connected.":
         db_owner = server_response['data']['user']['name']
         self.data = database_utils.get_db_data(db_owner)
         self.data['template'] = 'template0'
         self.db_name = self.data['name']
         response = self.tester.post(self.url + str(utils.SERVER_GROUP) +
                                     "/" + str(self.server_id) + "/",
                                     data=json.dumps(self.data),
                                     content_type='html/json')
         self.assertEquals(response.status_code, 200)
         response_data = json.loads(response.data.decode('utf-8'))
         db_id = response_data['node']['_id']
         db_dict = {
             "server_id": self.server_id,
             "db_id": db_id,
             "db_name": self.db_name
         }
         utils.write_node_info("did", db_dict)
     else:
         raise Exception("Error while connecting server to add the"
                         " database.")
Beispiel #6
0
 def setUp(self):
     self.server_id = parent_node_dict["server"][-1]["server_id"]
     self.role_name = "role_get_%s" % str(uuid.uuid4())[1:8]
     self.role_id = roles_utils.create_role(self.server, self.role_name)
     role_dict = {"server_id": self.server_id, "role_id": self.role_id,
                  "role_name": self.role_name}
     utils.write_node_info("lrid", role_dict)
Beispiel #7
0
 def runTest(self):
     """ This function will add the server under default server group."""
     url = "{0}{1}/".format(self.url, utils.SERVER_GROUP)
     response = self.tester.post(url, data=json.dumps(self.server),
                                 content_type='html/json')
     self.assertEquals(response.status_code, 200)
     response_data = json.loads(response.data.decode('utf-8'))
     self.server_id = response_data['node']['_id']
     server_dict = {"server_id": int(self.server_id)}
     utils.write_node_info("sid", server_dict)
Beispiel #8
0
 def runTest(self):
     """ This function will add the server under default server group."""
     url = "{0}{1}/".format(self.url, utils.SERVER_GROUP)
     response = self.tester.post(url, data=json.dumps(self.server),
                                 content_type='html/json')
     self.assertEquals(response.status_code, 200)
     response_data = json.loads(response.data.decode('utf-8'))
     self.server_id = response_data['node']['_id']
     server_dict = {"server_id": int(self.server_id)}
     utils.write_node_info("sid", server_dict)
    def setUp(self):
        """This function add the server to test the PUT API"""
        if hasattr(self, 'clear_save_password'):
            self.server['save_password'] = 1
        create_server_url = "/browser/server/obj/{0}/".format(
            utils.SERVER_GROUP)

        self.server_id = \
            servers_utils.create_server_with_api(self, create_server_url)
        server_dict = {"server_id": self.server_id}
        utils.write_node_info("sid", server_dict)
Beispiel #10
0
    def setUp(self):

        if config.SERVER_MODE is True:
            self.server['shared'] = True
            url = "/browser/server/obj/{0}/".format(utils.SERVER_GROUP)
            response = self.tester.post(url,
                                        data=json.dumps(self.server),
                                        content_type='html/json')
            response_data = json.loads(response.data.decode('utf-8'))
            self.server_id = response_data['node']['_id']

            server_dict = {"server_id": response_data['node']['_id']}
            utils.write_node_info("sid", server_dict)
Beispiel #11
0
 def setUp(self):
     if not self.server['tablespace_path']\
             or self.server['tablespace_path'] is None:
         message = "Tablespace delete test case. Tablespace path" \
                   " not configured for server: %s" % self.server['name']
         # Skip the test case if tablespace_path not found.
         self.skipTest(message)
     self.tablespace_name = "tablespace_delete_%s" % str(uuid.uuid4())[1:8]
     self.tablespace_id = tablespace_utils.create_tablespace(
         self.server, self.tablespace_name)
     self.server_id = parent_node_dict["server"][-1]["server_id"]
     tablespace_dict = {"tablespace_id": self.tablespace_id,
                        "tablespace_name": self.tablespace_name,
                        "server_id": self.server_id}
     utils.write_node_info("tsid", tablespace_dict)
Beispiel #12
0
 def setUp(self):
     if not self.server['tablespace_path']\
             or self.server['tablespace_path'] is None:
         message = "Tablespace delete test case. Tablespace path" \
                   " not configured for server: %s" % self.server['name']
         # Skip the test case if tablespace_path not found.
         self.skipTest(message)
     self.tablespace_name = "tablespace_delete_%s" % str(uuid.uuid4())[1:6]
     self.tablespace_id = tablespace_utils.create_tablespace(
         self.server, self.tablespace_name)
     self.server_id = parent_node_dict["server"][-1]["server_id"]
     tablespace_dict = {"tablespace_id": self.tablespace_id,
                        "tablespace_name": self.tablespace_name,
                        "server_id": self.server_id}
     utils.write_node_info("tsid", tablespace_dict)
Beispiel #13
0
    def setUp(self):
        """This function add the server to test the GET API"""
        if hasattr(self, 'shared'):

            self.server['shared'] = True
            url = "{0}{1}/".format(self.url, utils.SERVER_GROUP)
            response = self.tester.post(url,
                                        data=json.dumps(self.server),
                                        content_type='html/json')
            response_data = json.loads(response.data.decode('utf-8'))
            self.server_id = response_data['node']['_id']
        else:
            self.server_id = utils.create_server(self.server)
        server_dict = {"server_id": self.server_id}
        utils.write_node_info("sid", server_dict)
Beispiel #14
0
    def setUp(self):
        """This function add the server to test the PUT API"""
        if config.SERVER_MODE is False:
            self.skipTest(
                "Can not run shared servers test cases in the Desktop mode.")
        self.server['shared'] = True
        if hasattr(self, 'clear_save_password'):
            self.server['save_password'] = 1
        create_server_url = "/browser/server/obj/{0}/".format(
            utils.SERVER_GROUP)

        self.server_id = \
            servers_utils.create_server_with_api(self, create_server_url)
        server_dict = {"server_id": self.server_id}
        utils.write_node_info("sid", server_dict)
Beispiel #15
0
    def setUp(self):
        """This function add the server to test the GET API"""

        if config.SERVER_MODE is False:
            self.skipTest(
                "Can not run shared servers test cases in the Desktop mode.")
        self.server['shared'] = True
        url = "{0}{1}/".format(self.url, utils.SERVER_GROUP)
        response = self.tester.post(url,
                                    data=json.dumps(self.server),
                                    content_type='html/json')
        response_data = json.loads(response.data.decode('utf-8'))
        self.server_id = response_data['node']['_id']

        server_dict = {"server_id": self.server_id}
        utils.write_node_info("sid", server_dict)
Beispiel #16
0
    def setUp(self):
        """This function add the server to test the GET API"""

        server_details = servers_utils.get_server_data(self.server)
        server_details['password'] = self.server['db_password']
        server_details['save_password'] = 1
        server_details['connect_now'] = 1

        url = "/browser/server/obj/{0}/".format(utils.SERVER_GROUP)

        response = self.tester.post(url,
                                    data=json.dumps(server_details),
                                    content_type='html/json')
        response_data = json.loads(response.data.decode('utf-8'))
        self.server_id = response_data['node']['_id']

        server_dict = {"server_id": self.server_id}
        utils.write_node_info("sid", server_dict)
    def runTest(self):
        """This function test the add role scenario"""
        server_id = parent_node_dict["server"][-1]["server_id"]
        server_response = server_utils.connect_server(self, server_id)
        if not server_response['data']['connected']:
            raise Exception("Server not found to add the role.")

        data = roles_utils.get_role_data(self.server['db_password'])
        self.role_name = data['rolname']
        response = self.tester.post(self.url + str(utils.SERVER_GROUP) + '/'
                                    + str(server_id) + '/',
                                    data=json.dumps(data),
                                    content_type='html/json')
        self.assertEquals(response.status_code, 200)
        response_data = json.loads(response.data.decode('utf-8'))
        role_id = response_data['node']['_id']
        role_dict = {"server_id": server_id, "role_id": role_id,
                     "role_name": self.role_name}
        utils.write_node_info("lrid", role_dict)
Beispiel #18
0
 def runTest(self):
     """ This function will add database under 1st server of tree node. """
     self.db_name = ''
     self.server_id = parent_node_dict["server"][-1]["server_id"]
     server_response = server_utils.connect_server(self, self.server_id)
     if server_response["info"] == "Server connected.":
         db_owner = server_response['data']['user']['name']
         self.data = database_utils.get_db_data(db_owner)
         self.data['template'] = 'template0'
         self.db_name = self.data['name']
         response = self.tester.post(self.url + str(utils.SERVER_GROUP) +
                                     "/" + str(self.server_id) + "/",
                                     data=json.dumps(self.data),
                                     content_type='html/json')
         self.assertEquals(response.status_code, 200)
         response_data = json.loads(response.data.decode('utf-8'))
         db_id = response_data['node']['_id']
         db_dict = {"server_id": self.server_id, "db_id": db_id,
                    "db_name": self.db_name}
         utils.write_node_info("did", db_dict)
     else:
         raise Exception("Error while connecting server to add the"
                         " database.")
Beispiel #19
0
    def runTest(self):
        """This function test the add tablespace API"""
        server_id = parent_node_dict["server"][-1]["server_id"]
        server_response = server_utils.connect_server(self, server_id)
        if not server_response['data']['connected']:
            raise Exception("Unable to connect server to get tablespace.")

        db_owner = server_response['data']['user']['name']
        table_space_path = self.server['tablespace_path']
        data = tablespace_utils.get_tablespace_data(
            table_space_path, db_owner)
        self.tablespace_name = data['name']
        response = self.tester.post(
            self.url + str(utils.SERVER_GROUP) + '/' + str(server_id) + '/',
            data=json.dumps(data),
            content_type='html/json'
        )
        self.assertEquals(response.status_code, 200)
        response_data = json.loads(response.data.decode('utf-8'))
        tablespace_id = response_data['node']['_id']
        tablespace_dict = {"tablespace_id": tablespace_id,
                           "tablespace_name": self.tablespace_name,
                           "server_id": server_id}
        utils.write_node_info("tsid", tablespace_dict)
Beispiel #20
0
    def runTest(self):
        """ This function will add the server under default server group."""
        url = "{0}{1}/".format(self.url, utils.SERVER_GROUP)
        _server = copy.deepcopy(self.server)
        # Update the flag as required
        _server['save_password'] = self.with_save
        if not self.with_pwd:
            # Remove the password from server object
            del _server['db_password']

        response = self.tester.post(url, data=json.dumps(_server),
                                    content_type='html/json')
        self.assertEquals(response.status_code, 200)
        response_data = json.loads(response.data.decode('utf-8'))
        self.server_id = response_data['node']['_id']
        server_dict = {"server_id": int(self.server_id)}
        # Fetch the node info to check if password was saved or not
        response = self.tester.get(self.url.replace('obj', 'nodes') +
                                   str(utils.SERVER_GROUP) + '/' +
                                   str(self.server_id),
                                   follow_redirects=True)
        self.assertEquals(response.status_code, 200)
        self.assertTrue('is_password_saved' in response.json['result'])
        utils.write_node_info("sid", server_dict)
Beispiel #21
0
    def runTest(self):
        """This function test the add tablespace API"""
        server_id = parent_node_dict["server"][-1]["server_id"]
        server_response = server_utils.connect_server(self, server_id)
        if not server_response['data']['connected']:
            raise Exception("Unable to connect server to get tablespace.")

        db_owner = server_response['data']['user']['name']
        table_space_path = self.server['tablespace_path']
        data = tablespace_utils.get_tablespace_data(
            table_space_path, db_owner)
        self.tablespace_name = data['name']
        response = self.tester.post(
            self.url + str(utils.SERVER_GROUP) + '/' + str(server_id) + '/',
            data=json.dumps(data),
            content_type='html/json'
        )
        self.assertEqual(response.status_code, 200)
        response_data = json.loads(response.data.decode('utf-8'))
        tablespace_id = response_data['node']['_id']
        tablespace_dict = {"tablespace_id": tablespace_id,
                           "tablespace_name": self.tablespace_name,
                           "server_id": server_id}
        utils.write_node_info("tsid", tablespace_dict)
Beispiel #22
0
    def setUp(self):
        """This function add the server to test the GET API"""

        self.server_id = utils.create_server(self.server)
        server_dict = {"server_id": self.server_id}
        utils.write_node_info("sid", server_dict)
Beispiel #23
0
 def setUp(self):
     """This function add the server to test the PUT API"""
     self.server_id = utils.create_server(self.server)
     server_dict = {"server_id": self.server_id}
     utils.write_node_info("sid", server_dict)
Beispiel #24
0
 def setUp(self):
     self.server_id = utils.create_server(self.server)
     server_dict = {"server_id": self.server_id}
     utils.write_node_info("sid", server_dict)