Skip to content

Commit

Permalink
fixed linting errors and failing functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zenmonkeykstop committed Jun 6, 2019
1 parent dc110a2 commit 21f4927
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
24 changes: 15 additions & 9 deletions securedrop/tests/functional/journalist_navigation_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,18 +769,21 @@ def _admin_visits_reset_2fa_hotp(self):
try:
# 2FA reset buttons show a tooltip with explanatory text on hover.
# Also, confirm the text on the tooltip is the correct one.
self.wait_for(lambda: self.driver.find_elements_by_css_selector(
"#button-reset-two-factor-hotp")[0])
hotp_reset_button = self.driver.find_elements_by_css_selector(
"#button-reset-two-factor-hotp")[0]
hotp_reset_button.location_once_scrolled_into_view
ActionChains(self.driver).move_to_element(hotp_reset_button).perform()
time.sleep(1)
explanatory_tooltip_opacity = self.driver.find_elements_by_css_selector(
tip_opacity = self.driver.find_elements_by_css_selector(
"#button-reset-two-factor-hotp span")[0].value_of_css_property('opacity')
explanatory_tooltip_content = self.driver.find_elements_by_css_selector(
tip_text = self.driver.find_elements_by_css_selector(
"#button-reset-two-factor-hotp span")[0].text

assert explanatory_tooltip_opacity == "1"
assert tip_opacity == "1"
if not hasattr(self, "accept_languages"):
assert explanatory_tooltip_content == "Reset 2FA for hardware tokens like Yubikey"
assert tip_text == "Reset 2FA for hardware tokens like Yubikey"
self.safe_click_by_id("button-reset-two-factor-hotp")
self._alert_wait()
self._alert_accept()
Expand All @@ -800,17 +803,20 @@ def _admin_visits_reset_2fa_totp(self):
# Also, confirm the text on the tooltip is the correct one.
totp_reset_button = self.driver.find_elements_by_css_selector(
"#button-reset-two-factor-totp")[0]
totp_reset_button.location_once_scrolled_into_view
ActionChains(self.driver).move_to_element(totp_reset_button).perform()
time.sleep(1)
explanatory_tooltip_opacity = self.driver.find_elements_by_css_selector(
tip_opacity = self.driver.find_elements_by_css_selector(
"#button-reset-two-factor-totp span")[0].value_of_css_property('opacity')
explanatory_tooltip_content = self.driver.find_elements_by_css_selector(
tip_text = self.driver.find_elements_by_css_selector(
"#button-reset-two-factor-totp span")[0].text

assert explanatory_tooltip_opacity == "1"
assert tip_opacity == "1"
if not hasattr(self, "accept_languages"):
assert explanatory_tooltip_content == "Reset 2FA for mobile apps such as FreeOTP or Google Authenticator"
totp_reset_button.click()
assert tip_text == "Reset 2FA for mobile apps such as FreeOTP or Google Authenticator"
self.safe_click_by_id("button-reset-two-factor-totp")
self._alert_wait()
self._alert_accept()

def _admin_creates_a_user(self, hotp):
self.safe_click_by_id("add-user")
Expand Down
1 change: 0 additions & 1 deletion securedrop/tests/functional/test_admin_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def test_admin_edits_totp_secret(self):
self._admin_adds_a_user()
self._admin_visits_edit_user()
self._admin_visits_reset_2fa_totp()
self._admin_accepts_2fa_js_alert()

def test_admin_deletes_user(self):
self._admin_logs_in()
Expand Down

0 comments on commit 21f4927

Please sign in to comment.