Merge pull request #156 from justinpotts/fix_flake8
Fixed Flake8 errors
This commit is contained in:
Коммит
42b20602fb
|
@ -16,7 +16,7 @@ class MockRun(dict):
|
|||
self['start_date'] = '2011-01-01'
|
||||
self['end_date'] = '2012-12-31'
|
||||
self['suite_list'] = None
|
||||
|
||||
|
||||
# update with any keyword arguments passed
|
||||
self.update(**kwargs)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class MockVersion(dict):
|
|||
|
||||
self['name'] = 'Test Version'
|
||||
self['product_name'] = 'Test Product'
|
||||
|
||||
|
||||
# update with any keyword arguments passed
|
||||
self.update(**kwargs)
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ class MoztrapAPI:
|
|||
self.params['permanent'] = True
|
||||
Assert.true(self._do_delete(uri, element['id']), 'Deletion of element %s failed' % element['name'])
|
||||
|
||||
#Finally delete the embedded Category
|
||||
# Finally delete the embedded Category
|
||||
uri = "api/v1/category"
|
||||
category = element['category']
|
||||
Assert.true(self._do_delete(uri, category['id']), 'Deletion of category %s failed' % category['name'])
|
||||
|
|
|
@ -187,8 +187,8 @@ class BaseTest(object):
|
|||
product=product['name'], version=version['name'], status=status,
|
||||
suite=suite_name, cases_amount=cases_amount, **kwargs)
|
||||
|
||||
#add product to dictionary to ensure that output of this method
|
||||
#is similar to create_case method
|
||||
# add product to dictionary to ensure that output of this method
|
||||
# is similar to create_case method
|
||||
for case in cases:
|
||||
case['product'] = product
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class Filter(Page):
|
|||
self.find_element(*self._filter_input_locator).send_keys(value)
|
||||
self.wait_for_element_to_be_visible(*_suggestion_locator)
|
||||
|
||||
#find suggestion and get value of its data-id attribute
|
||||
# find suggestion and get value of its data-id attribute
|
||||
suggestion = self.find_element(*_suggestion_locator)
|
||||
data_id = suggestion.get_attribute('data-id')
|
||||
suggestion.click()
|
||||
|
@ -43,7 +43,7 @@ class Filter(Page):
|
|||
self.wait_for_element_to_be_visible(*_filter_item_locator)
|
||||
self.wait_for_ajax()
|
||||
|
||||
#find filter item and pass it as base element into FilterItem class
|
||||
# find filter item and pass it as base element into FilterItem class
|
||||
filter_item = self.find_element(*_filter_item_locator)
|
||||
return FilterItem(self.testsetup, filter_item)
|
||||
|
||||
|
@ -53,7 +53,7 @@ class Filter(Page):
|
|||
|
||||
self.wait_for_element_to_be_visible(*self._filter_suggestion_dropdown_locator)
|
||||
|
||||
#find suggestion and get value of its data-id attribute
|
||||
# find suggestion and get value of its data-id attribute
|
||||
suggestion = self.find_element(*self._filter_suggestion_dropdown_locator)
|
||||
data_id = suggestion.get_attribute('data-id')
|
||||
suggestion.click()
|
||||
|
@ -66,7 +66,7 @@ class Filter(Page):
|
|||
self.wait_for_element_to_be_visible(*_filter_item_locator)
|
||||
self.wait_for_ajax()
|
||||
|
||||
#find filter item and pass it as base element into FilterItem class
|
||||
# find filter item and pass it as base element into FilterItem class
|
||||
filter_item = self.find_element(*_filter_item_locator)
|
||||
return FilterItem(self.testsetup, filter_item)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class MultiselectWidget(Page):
|
|||
for web_element in self.find_elements(*self._included_item_locator)]
|
||||
|
||||
def include_items(self, item_names_list):
|
||||
#wait till available and included items are loaded
|
||||
# wait till available and included items are loaded
|
||||
self.wait_for_element_not_present(*self._loading_available_items_locator)
|
||||
self.wait_for_element_not_present(*self._loading_included_items_locator)
|
||||
include_button = self.find_element(*self._include_item_button_locator)
|
||||
|
|
|
@ -30,7 +30,7 @@ class TestManageCasesPage(BaseTest):
|
|||
Assert.false(manage_cases_pg.is_element_present(*case['locator']))
|
||||
|
||||
def test_that_deleting_single_version_of_case_does_not_delete_all_versions(self, mozwebqa_logged_in, product):
|
||||
#prerequisites
|
||||
# prerequisites
|
||||
test_case = self.create_case(mozwebqa_logged_in, product=product, use_API=True)
|
||||
|
||||
first_version = product['version']
|
||||
|
@ -43,7 +43,7 @@ class TestManageCasesPage(BaseTest):
|
|||
filter_item = manage_cases_pg.filter_form.filter_by(lookup='product', value=product['name'])
|
||||
test_cases = manage_cases_pg.test_cases
|
||||
|
||||
#remember case version and delete case
|
||||
# remember case version and delete case
|
||||
deleted_version = test_cases[0].product_version
|
||||
product_versions.remove(deleted_version)
|
||||
test_cases[0].delete()
|
||||
|
@ -52,13 +52,13 @@ class TestManageCasesPage(BaseTest):
|
|||
manage_cases_pg.filter_form.filter_by(lookup='name', value=test_case['name'])
|
||||
test_cases = manage_cases_pg.test_cases
|
||||
|
||||
#check that there is only one test case left and ensure its version equals to second version
|
||||
# check that there is only one test case left and ensure its version equals to second version
|
||||
Assert.equal(len(test_cases), 1, u'there should be only one case')
|
||||
Assert.equal(test_cases[0].name, test_case['name'], u'that\'s wrong test case')
|
||||
Assert.equal(test_cases[0].product_version, product_versions[0], u'that\'s wrong product version')
|
||||
|
||||
def test_that_manage_cases_list_shows_all_case_versions_individually(self, mozwebqa_logged_in, product):
|
||||
#prerequisites
|
||||
# prerequisites
|
||||
test_case = self.create_case(mozwebqa_logged_in, product=product, use_API=True)
|
||||
first_version = product['version']
|
||||
second_version = self.create_version(mozwebqa_logged_in, product=product)
|
||||
|
@ -73,7 +73,7 @@ class TestManageCasesPage(BaseTest):
|
|||
for case in filtered_cases:
|
||||
Assert.equal(case.name, test_case['name'], u'that\'s wrong case we\'ve got here')
|
||||
|
||||
#check that both product versions are displayed
|
||||
# check that both product versions are displayed
|
||||
Assert.equal(
|
||||
sorted(product_versions),
|
||||
sorted([case.product_version for case in filtered_cases]),
|
||||
|
|
|
@ -29,12 +29,12 @@ class TestManageRunsPage(BaseTest):
|
|||
|
||||
@pytest.mark.moztrap(3302)
|
||||
def test_for_edit_active_run_that_includes_suites_to_be_sure_they_are_listed(self, mozwebqa_logged_in, product):
|
||||
#create version
|
||||
# create version
|
||||
version = product['version']
|
||||
#create two test suites
|
||||
# create two test suites
|
||||
suite_a = self.create_suite(mozwebqa_logged_in, product=product, use_API=True, name='suite A')
|
||||
suite_b = self.create_suite(mozwebqa_logged_in, product=product, use_API=True, name='suite B')
|
||||
#create test run
|
||||
# create test run
|
||||
suite_order = [suite_b['name'], suite_a['name']]
|
||||
test_run = self.create_run(
|
||||
mozwebqa_logged_in, product=product,
|
||||
|
@ -46,11 +46,11 @@ class TestManageRunsPage(BaseTest):
|
|||
manage_runs_pg.activate_run(name=test_run['name'])
|
||||
edit_run_pg = manage_runs_pg.go_to_edit_run_page(test_run['name'])
|
||||
|
||||
#assert that multiselect widget is not present thus suites list is readonly
|
||||
# assert that multiselect widget is not present thus suites list is readonly
|
||||
Assert.false(
|
||||
edit_run_pg.is_multiselect_widget_present,
|
||||
u'multiselect widget should not be present')
|
||||
#assert that order of suites is correct
|
||||
# assert that order of suites is correct
|
||||
Assert.equal(
|
||||
suite_order, edit_run_pg.readonly_included_suites,
|
||||
u'suites are listed in wrong order')
|
||||
|
@ -59,7 +59,7 @@ class TestManageRunsPage(BaseTest):
|
|||
test_run = manage_runs_pg.test_runs[0]
|
||||
test_run.show_details()
|
||||
|
||||
#assert that order of suites is still correct
|
||||
# assert that order of suites is still correct
|
||||
Assert.equal(
|
||||
suite_order, test_run.included_suites,
|
||||
u'suites are listed in wrong order')
|
||||
|
|
|
@ -46,7 +46,7 @@ class TestManageSuitesPage(BaseTest):
|
|||
|
||||
@pytest.mark.moztrap(2743)
|
||||
def test_editing_of_existing_suite_that_has_no_included_cases(self, mozwebqa_logged_in, product):
|
||||
#create suite and cases
|
||||
# create suite and cases
|
||||
suite = self.create_suite(mozwebqa_logged_in, product, use_API=True)
|
||||
cases = self.create_bulk_cases(mozwebqa_logged_in, product, use_API=True, cases_amount=3)
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ class TestPinningFilters(BaseTest):
|
|||
manage_runs_pg.go_to_manage_runs_page()
|
||||
filter_item = manage_runs_pg.filter_form.filter_by(lookup='productversion', value=product_version_name)
|
||||
|
||||
#check that filter is not orange before it's pinned
|
||||
# check that filter is not orange before it's pinned
|
||||
self.check_pinned_filter(filter_item, is_pinned=False)
|
||||
filter_item.pin_filter()
|
||||
|
||||
#check that filter is orange after it's been pinned
|
||||
# check that filter is orange after it's been pinned
|
||||
self.check_pinned_filter(filter_item, is_pinned=True)
|
||||
|
||||
create_run_pg = manage_runs_pg.click_create_run_button()
|
||||
|
@ -52,35 +52,35 @@ class TestPinningFilters(BaseTest):
|
|||
manage_cases_pg = MozTrapManageCasesPage(mozwebqa_logged_in)
|
||||
manage_cases_pg.go_to_manage_cases_page()
|
||||
|
||||
#filter cases by name and assert that only cases with mozilla in their name are found
|
||||
# filter cases by name and assert that only cases with mozilla in their name are found
|
||||
cases_filter = manage_cases_pg.filter_form.filter_by(lookup='name', value=good_case_name)
|
||||
Assert.equal(cases_filter.content_text, good_case_name)
|
||||
self.check_pinned_filter(cases_filter, is_pinned=False)
|
||||
for case in manage_cases_pg.test_cases:
|
||||
Assert.contains(good_case_name, case.name.lower())
|
||||
|
||||
#pin filter and assert that it turns orange
|
||||
# pin filter and assert that it turns orange
|
||||
cases_filter.pin_filter()
|
||||
self.check_pinned_filter(cases_filter, is_pinned=True)
|
||||
|
||||
manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in)
|
||||
manage_suites_pg.go_to_manage_suites_page()
|
||||
|
||||
#check that there is no filters applied
|
||||
# check that there is no filters applied
|
||||
Assert.equal(manage_suites_pg.filter_form.filter_items, [])
|
||||
|
||||
#filter suites by name and assert that only suites with moztrap in their name are found
|
||||
# filter suites by name and assert that only suites with moztrap in their name are found
|
||||
suites_filter = manage_suites_pg.filter_form.filter_by(lookup='name', value=good_suite_name)
|
||||
Assert.equal(suites_filter.content_text, good_suite_name.lower())
|
||||
self.check_pinned_filter(suites_filter, is_pinned=False)
|
||||
for suite in manage_suites_pg.test_suites:
|
||||
Assert.contains(good_suite_name, suite.name)
|
||||
|
||||
#pin filter and assert that it turns orange
|
||||
# pin filter and assert that it turns orange
|
||||
suites_filter.pin_filter()
|
||||
self.check_pinned_filter(suites_filter, is_pinned=True)
|
||||
|
||||
#and check everything again on manage cases page
|
||||
# and check everything again on manage cases page
|
||||
manage_cases_pg.go_to_manage_cases_page()
|
||||
applied_filter = manage_cases_pg.filter_form.filter_items
|
||||
Assert.equal(len(applied_filter), 1)
|
||||
|
@ -88,7 +88,7 @@ class TestPinningFilters(BaseTest):
|
|||
for case in manage_cases_pg.test_cases:
|
||||
Assert.contains(good_case_name, case.name.lower())
|
||||
|
||||
#and check everything one more time on manage suites page
|
||||
# and check everything one more time on manage suites page
|
||||
manage_suites_pg.go_to_manage_suites_page()
|
||||
applied_filter = manage_suites_pg.filter_form.filter_items
|
||||
Assert.equal(len(applied_filter), 1)
|
||||
|
@ -96,11 +96,11 @@ class TestPinningFilters(BaseTest):
|
|||
for suite in manage_suites_pg.test_suites:
|
||||
Assert.contains(good_suite_name, suite.name)
|
||||
|
||||
#and go to manage runs page and see no filters there
|
||||
# and go to manage runs page and see no filters there
|
||||
manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in)
|
||||
manage_runs_pg.go_to_manage_runs_page()
|
||||
|
||||
#check that there is no filters applied
|
||||
# check that there is no filters applied
|
||||
Assert.equal(manage_runs_pg.filter_form.filter_items, [])
|
||||
|
||||
@pytest.mark.moztrap(5933)
|
||||
|
@ -109,11 +109,11 @@ class TestPinningFilters(BaseTest):
|
|||
manage_suites_pg.go_to_manage_suites_page()
|
||||
filter_item = manage_suites_pg.filter_form.filter_by(lookup='product', value=product['name'])
|
||||
|
||||
#check that filter is not orange before it's pinned
|
||||
# check that filter is not orange before it's pinned
|
||||
self.check_pinned_filter(filter_item, is_pinned=False)
|
||||
filter_item.pin_filter()
|
||||
|
||||
#check that filter is orange after it's been pinned
|
||||
# check that filter is orange after it's been pinned
|
||||
self.check_pinned_filter(filter_item, is_pinned=True)
|
||||
|
||||
create_suite_pg = manage_suites_pg.click_create_suite_button()
|
||||
|
@ -142,7 +142,7 @@ class TestPinningFilters(BaseTest):
|
|||
item.pin_filter()
|
||||
self.check_pinned_filter(item, is_pinned=True)
|
||||
|
||||
#go to create case page
|
||||
# go to create case page
|
||||
create_case_pg = manage_cases_pg.click_create_case_button()
|
||||
Assert.equal(create_case_pg.product_value, product['name'])
|
||||
Assert.equal(create_case_pg.product_version_value, version['name'])
|
||||
|
@ -150,7 +150,7 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
create_case_pg.go_back()
|
||||
|
||||
#go to create bulk cases page
|
||||
# go to create bulk cases page
|
||||
create_bulk_cases_pg = manage_cases_pg.click_create_bulk_cases_button()
|
||||
Assert.equal(create_bulk_cases_pg.product_value, product['name'])
|
||||
Assert.equal(create_bulk_cases_pg.product_version_value, version['name'])
|
||||
|
@ -162,11 +162,11 @@ class TestPinningFilters(BaseTest):
|
|||
manage_versions_pg.go_to_manage_versions_page()
|
||||
filter_item = manage_versions_pg.filter_form.filter_by(lookup='product', value=product['name'])
|
||||
|
||||
#check that filter is not orange before it's pinned
|
||||
# check that filter is not orange before it's pinned
|
||||
self.check_pinned_filter(filter_item, is_pinned=False)
|
||||
filter_item.pin_filter()
|
||||
|
||||
#check that filter is orange after it's been pinned
|
||||
# check that filter is orange after it's been pinned
|
||||
self.check_pinned_filter(filter_item, is_pinned=True)
|
||||
|
||||
create_version_pg = manage_versions_pg.click_create_version_button()
|
||||
|
@ -244,13 +244,13 @@ class TestPinningFilters(BaseTest):
|
|||
def check_pinned_filter(self, filter_item, is_pinned):
|
||||
pinned_filter_color = u'#DFB081'
|
||||
if is_pinned:
|
||||
#check that filter is orange after it's been pinned
|
||||
# check that filter is orange after it's been pinned
|
||||
Assert.equal(
|
||||
filter_item.get_filter_color(),
|
||||
pinned_filter_color,
|
||||
u'pinned filter\'s color is not orange')
|
||||
else:
|
||||
#check that filter is not orange before it's pinned
|
||||
# check that filter is not orange before it's pinned
|
||||
Assert.not_equal(
|
||||
filter_item.get_filter_color(),
|
||||
pinned_filter_color,
|
||||
|
|
|
@ -58,22 +58,22 @@ class TestRunTestsPage(BaseTest):
|
|||
def test_that_test_run_saves_right_order_of_test_cases(self, mozwebqa_logged_in, product, element):
|
||||
self.connect_product_to_element(mozwebqa_logged_in, product, element)
|
||||
version = product['version']
|
||||
#create several test case via bulk create
|
||||
# create several test case via bulk create
|
||||
cases = self.create_bulk_cases(mozwebqa_logged_in, product, use_API=True, cases_amount=5)
|
||||
#create first test suite
|
||||
# create first test suite
|
||||
suite_a_cases = (cases[3], cases[1])
|
||||
suite_a = self.create_suite(
|
||||
mozwebqa_logged_in, product=product, use_API=True, name='suite A', case_list=suite_a_cases)
|
||||
#create second test suite
|
||||
# create second test suite
|
||||
suite_b_cases = (cases[2], cases[0], cases[4])
|
||||
suite_b = self.create_suite(
|
||||
mozwebqa_logged_in, product=product, use_API=True, name='suite B', case_list=suite_b_cases)
|
||||
#create first test run (suite a, suite b)
|
||||
# create first test run (suite a, suite b)
|
||||
first_suite_order = (suite_a['name'], suite_b['name'])
|
||||
first_run = self.create_run(
|
||||
mozwebqa_logged_in, product=product, activate=True,
|
||||
version=version, suite_name_list=first_suite_order)
|
||||
#execute first test run
|
||||
# execute first test run
|
||||
home_page = MozTrapHomePage(mozwebqa_logged_in)
|
||||
home_page.go_to_home_page()
|
||||
home_page.go_to_run_test(
|
||||
|
@ -85,30 +85,30 @@ class TestRunTestsPage(BaseTest):
|
|||
|
||||
expected_order = [(case['name'], suite) for case in suite_a_cases for suite in (suite_a['name'],)] + \
|
||||
[(case['name'], suite) for case in suite_b_cases for suite in (suite_b['name'],)]
|
||||
#assert that right order saved
|
||||
# assert that right order saved
|
||||
Assert.equal(actual_order, expected_order)
|
||||
#edit run to reorder suites
|
||||
# edit run to reorder suites
|
||||
manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in)
|
||||
manage_runs_pg.go_to_manage_runs_page()
|
||||
#push run into draft mode
|
||||
# push run into draft mode
|
||||
manage_runs_pg.filter_form.filter_by(lookup='name', value=first_run['name'])
|
||||
manage_runs_pg.make_run_draft(first_run['name'])
|
||||
#go to edit run page and reorder suites by name (suite b, suite a)
|
||||
# go to edit run page and reorder suites by name (suite b, suite a)
|
||||
edit_run_pg = manage_runs_pg.go_to_edit_run_page(first_run['name'])
|
||||
edit_run_pg.edit_run(first_run, reorder_suites=True)
|
||||
#make run active again
|
||||
# make run active again
|
||||
manage_runs_pg.activate_run(first_run['name'])
|
||||
#execute run again
|
||||
# execute run again
|
||||
home_page.go_to_home_page()
|
||||
home_page.go_to_run_test(
|
||||
product_name=product['name'], version_name=version['name'], run_name=first_run['name'],
|
||||
env_category_name=element['category']['name'], env_element_name=element['name'])
|
||||
#check actual order of items on run tests page
|
||||
# check actual order of items on run tests page
|
||||
actual_order = [(item.case_name, item.suite_name) for item in run_tests_pg.test_results]
|
||||
|
||||
expected_order = [(case['name'], suite) for case in suite_b_cases for suite in (suite_b['name'],)] + \
|
||||
[(case['name'], suite) for case in suite_a_cases for suite in (suite_a['name'],)]
|
||||
#assert that right order saved
|
||||
# assert that right order saved
|
||||
Assert.equal(actual_order, expected_order)
|
||||
|
||||
def test_that_user_can_mark_test_as_blocked(self, mozwebqa_logged_in, product, element):
|
||||
|
|
Загрузка…
Ссылка в новой задаче