Fix PEP-8 issues.

This commit is contained in:
Dave Page 2019-03-21 12:58:52 +00:00
parent 33693734fc
commit b2b5629a01
5 changed files with 21 additions and 25 deletions

View File

@ -83,9 +83,6 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
status = self.page.find_by_css_selector( status = self.page.find_by_css_selector(
".pg-bg-status-text").text ".pg-bg-status-text").text
print("Debug: .pg-bg-status-text %s"%status)
#.pg-bg-status-text
self.assertEquals(status, "Successfully completed.") self.assertEquals(status, "Successfully completed.")
self.page.find_by_css_selector( self.page.find_by_css_selector(

View File

@ -176,11 +176,11 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest):
Keys.CONTROL).send_keys(Keys.SPACE).key_up(Keys.CONTROL).perform() Keys.CONTROL).send_keys(Keys.SPACE).key_up(Keys.CONTROL).perform()
# if IntelliSense is present then verify this # if IntelliSense is present then verify this
if self.page.check_if_element_exist_by_xpath\ if self.page.check_if_element_exist_by_xpath(
("//ul[@class='CodeMirror-hints default']", 2): "//ul[@class='CodeMirror-hints default']", 2):
self.page.find_by_xpath( self.page.find_by_xpath(
"//ul[contains(@class, 'CodeMirror-hints') and " "//ul[contains(@class, 'CodeMirror-hints') and "
"contains(., '" + expected_string + "')]") "contains(., '" + expected_string + "')]")
else: else:
# if no IntelliSense is present it means there is only one option # if no IntelliSense is present it means there is only one option
# so check if required string is present in codeMirror # so check if required string is present in codeMirror
@ -188,6 +188,6 @@ class QueryToolAutoCompleteFeatureTest(BaseFeatureTest):
"//pre[@class=' CodeMirror-line ']/span") "//pre[@class=' CodeMirror-line ']/span")
code_mirror_text = code_mirror.text code_mirror_text = code_mirror.text
if not expected_string in code_mirror_text: if expected_string not in code_mirror_text:
raise Exception("Required String %s is not " raise Exception("Required String %s is not "
"present"%expected_string) "present" % expected_string)

View File

@ -93,14 +93,14 @@ class QueryToolJourneyTest(BaseFeatureTest):
"does not exist", failed_history_detail_pane.text "does not exist", failed_history_detail_pane.text
) )
self.page.wait_for_element(lambda driver: driver self.page.wait_for_element(lambda driver: driver
.find_element_by_css_selector .find_element_by_css_selector(
("#query_list> .query-group>ul>li")) "#query_list> .query-group>ul>li"))
# get the query history rows and click the previous query row which # get the query history rows and click the previous query row which
# was executed and verify it # was executed and verify it
history_rows = self.driver.find_elements_by_css_selector( history_rows = self.driver.find_elements_by_css_selector(
"#query_list> .query-group>ul>li") "#query_list> .query-group>ul>li")
print("the number of history_rows are 10 %s"%len(history_rows)) print("the number of history_rows are 10 %s" % len(history_rows))
history_rows[1].click() history_rows[1].click()
selected_history_entry = self.page.find_by_css_selector( selected_history_entry = self.page.find_by_css_selector(

View File

@ -183,7 +183,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format(
# wait for header of the table to be visible # wait for header of the table to be visible
wait.until(EC.visibility_of_element_located( wait.until(EC.visibility_of_element_located(
(By.XPATH,'//div[@class="slick-header-columns"]'))) (By.XPATH, '//div[@class="slick-header-columns"]')))
wait.until(EC.presence_of_element_located( wait.until(EC.presence_of_element_located(
(By.XPATH, (By.XPATH,
@ -209,7 +209,8 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format(
# wait for header of the table to be visible # wait for header of the table to be visible
wait.until(EC.visibility_of_element_located( wait.until(EC.visibility_of_element_located(
(By.XPATH,'//div[@class="slick-header-columns"]'))) (By.XPATH, '//div[@class="slick-header-columns"]')))
# wait for first row to contain value # wait for first row to contain value
wait.until(EC.presence_of_element_located( wait.until(EC.presence_of_element_located(
(By.XPATH, (By.XPATH,
@ -234,7 +235,7 @@ SELECT generate_series(1, {}) as id1, 'dummy' as id2""".format(
# wait for header of the table to be visible # wait for header of the table to be visible
wait.until(EC.visibility_of_element_located( wait.until(EC.visibility_of_element_located(
(By.XPATH,'//div[@class="slick-header-columns"]'))) (By.XPATH, '//div[@class="slick-header-columns"]')))
wait.until(EC.presence_of_element_located( wait.until(EC.presence_of_element_located(
(By.XPATH, (By.XPATH,
@ -426,9 +427,7 @@ SELECT relname FROM pg_class
self.page.wait_for_query_tool_loading_indicator_to_disappear() self.page.wait_for_query_tool_loading_indicator_to_disappear()
def _query_tool_auto_commit_enabled(self): def _query_tool_auto_commit_enabled(self):
query = """-- 1. Enable auto commit. query = """-- 1. Enable auto commit.
-- 2. END any open transaction. -- 2. END any open transaction.
-- 3. Create table in public schema. -- 3. Create table in public schema.
@ -749,7 +748,7 @@ SELECT 1, pg_sleep(300)"""
show_jit = pg_cursor.fetchone() show_jit = pg_cursor.fetchone()
if show_jit[0] == 'on': if show_jit[0] == 'on':
jit_enabled = True jit_enabled = True
except: except Exception as e:
pass pass
is_edb = False is_edb = False

View File

@ -185,12 +185,12 @@ class PgadminPage:
"""The function will be used for opening Trees node only""" """The function will be used for opening Trees node only"""
# get the element which contains 'aria-expanded' info # get the element which contains 'aria-expanded' info
tables_expansion_ele =self.find_by_xpath("//div[div[div[div[div[div" tables_expansion_ele = self.find_by_xpath("//div[div[div[div[div[div"
"[div[div[span[span[" "[div[div[span[span["
"(@class='aciTreeText') and " "(@class='aciTreeText') and "
"text()='Tables']]]]]]]]]]") "text()='Tables']]]]]]]]]]")
if tables_expansion_ele.get_attribute('aria-expanded') =='false': if tables_expansion_ele.get_attribute('aria-expanded') == 'false':
# button element of the Tables node to open it # button element of the Tables node to open it
item_button = self.find_by_xpath( item_button = self.find_by_xpath(
"//div[span[span[(@class='aciTreeText') and text()" "//div[span[span[(@class='aciTreeText') and text()"
@ -394,9 +394,9 @@ class PgadminPage:
element_found = False element_found = False
try: try:
WebDriverWait(self.driver, timeout, .01).until( WebDriverWait(self.driver, timeout, .01).until(
EC.visibility_of_element_located((By.XPATH, xpath))) EC.visibility_of_element_located((By.XPATH, xpath)))
element_found = True element_found = True
except: except Exception as e:
pass pass
return element_found return element_found