Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Fix flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bebef1987 committed Apr 1, 2015
1 parent e6b5598 commit 570542f
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 49 deletions.
4 changes: 2 additions & 2 deletions mocks/marketplace_api.py
Expand Up @@ -24,10 +24,10 @@ def __init__(self, credentials=None, domain=None):

def submit_app(self, app):

#validate app manifest
# validate app manifest
self._validate_manifest(app)

#create app
# create app
self._create_app(app)

# update the app with the mock app data
Expand Down
1 change: 1 addition & 0 deletions mocks/mock_review.py
Expand Up @@ -7,6 +7,7 @@
import string
import random


class MockReview(dict):

def __init__(self, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion pages/desktop/consumer_pages/add_review.py
Expand Up @@ -20,7 +20,7 @@ class AddReview(Base):

def set_review_rating(self, rating):
self.selenium.find_element(self._star_rating_locator[0],
'%s[data-stars="%s"]' % (self._star_rating_locator[1], rating)).click()
'%s[data-stars="%s"]' % (self._star_rating_locator[1], rating)).click()

def enter_review_with_text(self, text):
self.selenium.find_element(*self._add_review_input_field_locator).send_keys(text)
Expand Down
6 changes: 3 additions & 3 deletions pages/desktop/developer_hub/base.py
Expand Up @@ -15,7 +15,7 @@
class Base(Page):

def login(self, mozwebqa, user):
base_test = BaseTest()
base_test = BaseTest()
credentials = base_test.get_user(mozwebqa)
fxa_login = self.header.click_login()
fxa_login.sign_in(credentials['email'], credentials['password'])
Expand All @@ -36,10 +36,10 @@ def left_nav_menu(self):

class HeaderRegion(Page):

#Not LoggedIn
# Not LoggedIn
_login_locator = (By.CSS_SELECTOR, 'a.browserid:not(.register)')

#LoggedIn
# LoggedIn
_account_menu_locator = (By.CSS_SELECTOR, '.header-button.icon.settings')
_logout_locator = (By.CSS_SELECTOR, '.logout')
_my_submissions_locator = (By.CSS_SELECTOR, '.devhub-links > [href*=submissions]')
Expand Down
8 changes: 4 additions & 4 deletions pages/desktop/developer_hub/developer_submissions.py
Expand Up @@ -43,7 +43,7 @@ def first_free_app(self):
"""Return the first free app in the listing."""
for i in range(1, self.paginator.total_page_number + 1):
for app in self.submitted_apps:
if app.has_price and app.price == 'Free' and not 'Disabled' in app.status:
if app.has_price and app.price == 'Free' and 'Disabled' not in app.status:
return app
if self.paginator.is_paginator_present:
if not self.paginator.is_next_page_disabled:
Expand Down Expand Up @@ -196,17 +196,17 @@ class Paginator(Page):
_paginator_locator = (By.CSS_SELECTOR, 'nav.paginator')
_apps_locator = (By.CSS_SELECTOR, 'div.items > div.item')

#Numbering
# Numbering
_page_number_locator = (By.CSS_SELECTOR, 'nav.paginator .num > a:nth-child(1)')
_total_page_number_locator = (By.CSS_SELECTOR, 'nav.paginator .num > a:nth-child(2)')

#Navigation
# Navigation
_first_page_locator = (By.CSS_SELECTOR, 'nav.paginator .rel a:nth-child(1)')
_prev_locator = (By.CSS_SELECTOR, 'nav.paginator .rel a.prev')
_next_locator = (By.CSS_SELECTOR, 'nav.paginator .rel a.next')
_last_page_locator = (By.CSS_SELECTOR, 'nav.paginator .rel a:nth-child(4)')

#Position
# Position
_start_item_number_locator = (By.CSS_SELECTOR, 'nav.paginator .pos b:nth-child(1)')
_end_item_number_locator = (By.CSS_SELECTOR, 'nav.paginator .pos b:nth-child(2)')
_total_item_number = (By.CSS_SELECTOR, 'nav.paginator .pos b:nth-child(3)')
Expand Down
12 changes: 6 additions & 6 deletions pages/desktop/developer_hub/edit_app.py
Expand Up @@ -48,20 +48,20 @@ def __init__(self, testsetup):
def click_edit_basic_info(self):
self.selenium.find_element(*self._edit_basic_info_locator).click()
WebDriverWait(self.selenium, self.timeout).until(lambda s: not self.is_element_present(*self._loading_locator)
and self.selenium.execute_script('return jQuery.active == 0'))
and self.selenium.execute_script('return jQuery.active == 0'))
return self.basic_info

def click_support_information(self):
self.selenium.find_element(*self._edit_support_information_locator).click()
WebDriverWait(self.selenium, self.timeout).until(lambda s: not self.is_element_present(*self._loading_locator)
and self.selenium.execute_script('return jQuery.active == 0'))
and self.selenium.execute_script('return jQuery.active == 0'))
return self.support_information

def click_edit_media(self):
self.selenium.find_element(*self._edit_media_locator).click()
self.wait_for_element_visible(*self._screenshot_upload_text_locator)
WebDriverWait(self.selenium, self.timeout).until(lambda s: not self.is_element_present(*self._loading_locator)
and self.selenium.execute_script('return jQuery.active == 0'))
and self.selenium.execute_script('return jQuery.active == 0'))
return self.media

@property
Expand Down Expand Up @@ -187,7 +187,7 @@ def type_description(self, text):
def click_save_changes(self):
self.selenium.find_element(*self._save_changes_locator).click()
WebDriverWait(self.selenium, self.timeout).until(lambda s: not self.is_element_present(*self._loading_locator)
and self.selenium.execute_script('return jQuery.active == 0'))
and self.selenium.execute_script('return jQuery.active == 0'))

def click_cancel(self):
self.selenium.find_element(*self._cancel_link_locator).click()
Expand All @@ -208,7 +208,7 @@ def type_support_url(self, text):
def click_save_changes(self):
self.selenium.find_element(*self._save_changes_locator).click()
WebDriverWait(self.selenium, self.timeout).until(lambda s: not self.is_element_present(*self._loading_locator)
and self.selenium.execute_script('return jQuery.active == 0'))
and self.selenium.execute_script('return jQuery.active == 0'))

class MediaRegion(Page):

Expand Down Expand Up @@ -269,7 +269,7 @@ def screenshot_upload(self, value):
def click_save_changes(self, expected_result='success'):
self.selenium.find_element(*self._save_changes_locator).click()
WebDriverWait(self.selenium, self.timeout).until(lambda s: not self.is_element_present(*self._loading_locator)
and self.selenium.execute_script('return jQuery.active == 0'))
and self.selenium.execute_script('return jQuery.active == 0'))

def click_cancel(self):
self.selenium.find_element(*self._cancel_link_locator).click()
2 changes: 1 addition & 1 deletion pages/desktop/developer_hub/manage_status.py
Expand Up @@ -46,7 +46,7 @@ def click_delete_app(self):
def click_upload_new_version(self):
self.selenium.find_element(*self._upload_new_version_locator).click()
WebDriverWait(self.selenium, self.timeout).until(lambda s: not self.is_element_present(*self._loading_locator)
and self.selenium.execute_script('return jQuery.active == 0'))
and self.selenium.execute_script('return jQuery.active == 0'))

def upload_file(self, zip_file):
self.selenium.find_element(*self._upload_app).send_keys(zip_file)
Expand Down
7 changes: 3 additions & 4 deletions pages/desktop/developer_hub/submit_app.py
Expand Up @@ -6,7 +6,6 @@

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException

from pages.desktop.developer_hub.base import Base
Expand Down Expand Up @@ -219,9 +218,9 @@ def fill_in_app_already_rated_info(self, submission_id, code):
security_code.send_keys(code)

def wait_for_content_ratings_table(self):
WebDriverWait(self.selenium, self.timeout).until(lambda s:
self.is_element_visible(*self._ratings_table_locator),
'Ratings table is not visible')
WebDriverWait(self.selenium, self.timeout).until(
lambda s: self.is_element_visible(*self._ratings_table_locator),
'Ratings table is not visible')

def click_submit(self):
self.selenium.find_element(*self._submit_button_locator).click()
Expand Down
2 changes: 1 addition & 1 deletion pages/desktop/paypal/paypal_sandbox.py
Expand Up @@ -63,6 +63,6 @@ def click_approve_button(self):
self.selenium.find_element(*self._approve_button_locator).click()
self.wait_for_progress_meter_to_load()
from pages.desktop.consumer_pages.account_settings import Payments
payments_page = Payments(self.testsetup) #redirect
payments_page = Payments(self.testsetup) # redirect
payments_page.wait_for_page_loaded()
return payments_page
5 changes: 3 additions & 2 deletions pages/desktop/regions/filter.py
Expand Up @@ -30,8 +30,9 @@ def __init__(self, testsetup, lookup):
Page.__init__(self, testsetup)

# expand the thing here to represent the proper user action
self._root_element = self.selenium.find_element(self._base_locator[0],
"%s/ul/li/a[normalize-space(text())='%s']" % (self._base_locator[1], lookup))
self._root_element = self.selenium.find_element(
self._base_locator[0],
"%s/ul/li/a[normalize-space(text())='%s']" % (self._base_locator[1], lookup))

@property
def name(self):
Expand Down
4 changes: 2 additions & 2 deletions pages/desktop/regions/lightbox.py
Expand Up @@ -14,13 +14,13 @@
class Lightbox(Page):

_image_viewer = (By.CSS_SELECTOR, '#lightbox > section')
#controls
# controls
_next_locator = (By.CSS_SELECTOR, 'div.controls > a.control.next')
_previous_locator = (By.CSS_SELECTOR, 'div.controls > a.control.prev')
_caption_locator = (By.CSS_SELECTOR, 'div.caption span')
_close_locator = (By.CSS_SELECTOR, '.close')

#content
# content
_images_locator = (By.CSS_SELECTOR, 'div.content > img')
_current_image_locator = (By.CSS_SELECTOR, 'div.content > #preview%s')

Expand Down
2 changes: 1 addition & 1 deletion pages/mobile/account_settings.py
Expand Up @@ -46,7 +46,7 @@ def click_sign_in(self):
def click_my_apps(self, logged_in=True):
self.scroll_to_element(self._settings_options_locator[0], self._settings_options_locator[1] % ("/purchases"))
self.selenium.find_element(self._settings_options_locator[0], self._settings_options_locator[1] % ("/purchases")).click()
if logged_in == True:
if logged_in:
WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_element_visible(*self._my_apps_locator))
else:
return AccountSettings(self.testsetup)
Expand Down
2 changes: 1 addition & 1 deletion pages/mobile/add_review.py
Expand Up @@ -21,7 +21,7 @@ class AddReview(Base):

def set_review_rating(self, rating):
self.selenium.find_element(self._star_rating_locator[0],
'%s[data-stars="%s"]' % (self._star_rating_locator[1], rating)).click()
'%s[data-stars="%s"]' % (self._star_rating_locator[1], rating)).click()

def enter_review_with_text(self, text):
self.selenium.find_element(*self._add_review_input_field_locator).clear()
Expand Down
2 changes: 0 additions & 2 deletions pages/mobile/base.py
Expand Up @@ -74,7 +74,6 @@ def login(self, user):
def header(self):
return self.Header(self.testsetup)


class Header(Page):

_settings_button_locator = (By.CSS_SELECTOR, '.active .header-button.icon.settings')
Expand Down Expand Up @@ -137,7 +136,6 @@ def search_suggestions(self):
suggestions = self.selenium.find_elements(*self._search_suggestion_locator)
return [self.SearchSuggestion(self.testsetup, suggestion) for suggestion in suggestions]


class SearchSuggestion(PageRegion):

_name_locator = (By.CSS_SELECTOR, 'a > span')
Expand Down
1 change: 0 additions & 1 deletion pages/mobile/details.py
Expand Up @@ -118,4 +118,3 @@ def is_visible(self):
@property
def review_id(self):
return self._root_element.get_attribute('data-report-uri').split('/')[5]

1 change: 0 additions & 1 deletion pages/page.py
Expand Up @@ -9,7 +9,6 @@
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import ElementNotVisibleException
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

Expand Down
28 changes: 14 additions & 14 deletions tests/desktop/consumer_pages/test_users_account.py
Expand Up @@ -128,24 +128,24 @@ def test_that_checks_changing_language(self, mozwebqa):
language = 'fr'

before_lang_change = [profile_page.get_url_current_page(),
profile_page.page_title,
profile_page.account_settings_header_text,
profile_page.display_name_field_text,
profile_page.language_field_text,
profile_page.region_field_text,
profile_page.header.search_field_placeholder,
profile_page.save_button_text]
profile_page.page_title,
profile_page.account_settings_header_text,
profile_page.display_name_field_text,
profile_page.language_field_text,
profile_page.region_field_text,
profile_page.header.search_field_placeholder,
profile_page.save_button_text]

profile_page.edit_language(language)
profile_page.save_changes()

after_lang_change = [profile_page.get_url_current_page(),
profile_page.page_title,
profile_page.account_settings_header_text,
profile_page.display_name_field_text,
profile_page.language_field_text,
profile_page.region_field_text,
profile_page.header.search_field_placeholder,
profile_page.save_button_text]
profile_page.page_title,
profile_page.account_settings_header_text,
profile_page.display_name_field_text,
profile_page.language_field_text,
profile_page.region_field_text,
profile_page.header.search_field_placeholder,
profile_page.save_button_text]

Assert.not_equal(before_lang_change, after_lang_change)
@@ -1,5 +1,5 @@
# !/usr/bin/env python
# coding: utf-8
#!/usr/bin/env python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -9,7 +9,6 @@

from unittestzero import Assert

from mocks.marketplace_api import MarketplaceAPI
from mocks.mock_application import MockApplication
from pages.desktop.developer_hub.home import Home
from tests.base_test import BaseTest
Expand Down
2 changes: 1 addition & 1 deletion tests/mobile/test_reviews.py
Expand Up @@ -77,7 +77,7 @@ def test_that_after_viewing_reviews_clicking_back_goes_to_app_page(self, mozwebq
Assert.contains(app_name, details_page.title)

def test_that_checks_the_addition_of_a_review(self, mozwebqa):

mock_review = MockReview()

home_page = Home(mozwebqa)
Expand Down

0 comments on commit 570542f

Please sign in to comment.