def before(self): self.page.wait_for_spinner_to_disappear() self.page.add_server(self.server) self.first_schema_name = "test_schema" + \ str(random.randint(1000, 3000)) test_utils.create_schema(self.server, self.test_db, self.first_schema_name) self.second_schema_name = "comp_schema" + \ str(random.randint(1000, 3000)) test_utils.create_schema(self.server, self.test_db, self.second_schema_name) self.first_table_name = "auto_comp_" + \ str(random.randint(1000, 3000)) test_utils.create_table(self.server, self.test_db, self.first_table_name) self.second_table_name = "auto_comp_" + \ str(random.randint(1000, 3000)) test_utils.create_table(self.server, self.test_db, self.second_table_name) self._locate_database_tree_node() self.page.open_query_tool() self.page.wait_for_spinner_to_disappear()
def runTest(self): """ When there are no foreign key properties on the column, it returns an empty result """ with test_utils.Database(self.server) as (connection, database_name): test_utils.create_table(self.server, database_name, "test_table") cursor = connection.cursor() cursor.execute("SELECT pg_class.oid as table_id, " "pg_attribute.attnum as column_id " "FROM pg_class join pg_attribute on " "attrelid=pg_class.oid " "where pg_class.relname='test_table'" " and pg_attribute.attname = 'some_column'") table_id, column_id = cursor.fetchone() if connection.server_version < 90100: self.versions_to_test = ['default'] else: self.versions_to_test = ['9.1_plus'] for version in self.versions_to_test: template_file = os.path.join( os.path.dirname(__file__), "..", version, "properties.sql" ) template = file_as_template(template_file) sql = template.render( tid=table_id, cid=column_id) cursor = connection.cursor() cursor.execute(sql) fetch_result = cursor.fetchall() self.assertEqual(0, len(fetch_result))
def before(self): # Create test table with random name to avoid same name conflicts in # parallel execution self.test_table_name = "test_table" + str(random.randint(1000, 3000)) test_utils.create_table( self.server, self.test_db, self.test_table_name) self.page.add_server(self.server)
def before(self): test_utils.create_table( self.server, self.test_db, self.test_table_name ) # This is needed to test dependents tab (eg: BackGrid) test_utils.create_constraint( self.server, self.test_db, self.test_table_name, "unique", "<h1 onmouseover='console.log(2);'>Y" )
def before(self): connection = test_utils.get_db_connection( self.server['db'], self.server['username'], self.server['db_password'], self.server['host'], self.server['port'] ) test_utils.drop_database(connection, "acceptance_test_db") test_utils.create_database(self.server, "acceptance_test_db") test_utils.create_table( self.server, "acceptance_test_db", "test_table") self.page.add_server(self.server)
def runTest(self): self.test_table_name = "test_table" + str(random.randint(1000, 3000)) test_utils.create_table(self.server, self.test_db, self.test_table_name) self.page.toggle_open_server(self.server['name']) self.page.toggle_open_tree_item('Databases') self.page.toggle_open_tree_item(self.test_db) self.page.toggle_open_tree_item('Schemas') self.page.toggle_open_tree_item('public') self.page.toggle_open_tree_item('Tables') self.page.select_tree_item(self.test_table_name) self.page.click_tab("SQL") self.page.find_by_xpath( "//*[contains(@class,'CodeMirror-lines') and " "contains(.,'CREATE TABLE public.%s')]" % self.test_table_name)
def runTest(self): if hasattr(self, "ignore_test"): return with test_utils.Database(self.server) as (connection, database_name): test_utils.create_table(self.server_with_modified_user, database_name, "test_new_role_table") cursor = connection.cursor() cursor.execute("SELECT pg_class.oid AS table_id " "FROM pg_class " "WHERE pg_class.relname='test_new_role_table'") self.table_id = cursor.fetchone()[0] sql = self.generate_sql('default') cursor.execute(sql) fetch_result = cursor.fetchall() self.assertions(fetch_result, cursor.description)
def before(self): connection = test_utils.get_db_connection( self.server['db'], self.server['username'], self.server['db_password'], self.server['host'], self.server['port'], self.server['sslmode'] ) test_utils.drop_database(connection, "acceptance_test_db") test_utils.create_database(self.server, "acceptance_test_db") test_utils.create_table( self.server, "acceptance_test_db", "<h1>X" ) # This is needed to test dependents tab (eg: BackGrid) test_utils.create_constraint( self.server, "acceptance_test_db", "<h1>X", "unique", "<h1 onmouseover='console.log(2);'>Y" )
def before(self): if self.server['default_binary_paths'] is None: self.skipTest( "default_binary_paths is not set for the server {0}".format( self.server['name'] ) ) connection = test_utils.get_db_connection( self.server['db'], self.server['username'], self.server['db_password'], self.server['host'], self.server['port'], self.server['sslmode'] ) test_utils.drop_database(connection, self.database_name) test_utils.create_database(self.server, self.database_name) test_utils.create_table(self.server, self.database_name, self.table_name) self.page.add_server(self.server) self.wait = WebDriverWait(self.page.driver, 20)
def runTest(self): if hasattr(self, "ignore_test"): return with test_utils.Database(self.server) as (connection, database_name): test_utils.create_table(self.server, database_name, "test_table") self.database_name = database_name if connection.server_version < 90100: self.versions_to_test = ['default'] else: self.versions_to_test = ['9.1_plus'] cursor = connection.cursor() self.test_setup(connection, cursor) for version in self.versions_to_test: sql = self.generate_sql(version) cursor = connection.cursor() cursor.execute(sql) fetch_result = cursor.fetchall() self.assertions(fetch_result, cursor.description)
def before(self): self.page.wait_for_spinner_to_disappear() self.page.add_server(self.server) self.test_table_name = "test_table" + str(random.randint(1000, 3000)) test_utils.create_table(self.server, self.test_db, self.test_table_name)
def before(self): self.test_table_name = "test_table" + str(random.randint(1000, 3000)) test_utils.create_table(self.server, self.test_db, self.test_table_name) self.page.add_server(self.server)
def before(self): self.test_table_name = "test_table" + str(random.randint(1000, 3000)) test_utils.create_table( self.server, self.test_db, self.test_table_name) self.page.add_server(self.server)