Skip to content

Instantly share code, notes, and snippets.

@bobsilverberg
Created June 5, 2013 12:44
Show Gist options
  • Select an option

  • Save bobsilverberg/5713590 to your computer and use it in GitHub Desktop.

Select an option

Save bobsilverberg/5713590 to your computer and use it in GitHub Desktop.
Example of using @pytest.mark.parametrize for mcom-tests
@pytest.mark.nondestructive
@pytest.mark.parametrize('link_list', ['product_link_list_1','product_link_list_2','product_link_list_3'])
def test_product_link_urls_are_valid(self, mozwebqa, link_list):
mozillabased_page = MozillaBasedPage(mozwebqa)
mozillabased_page.go_to_page()
bad_urls = []
links = getattr(mozillabased_page, link_list)
for link in links:
url = mozillabased_page.link_destination(link.get('locator'))
response_code = mozillabased_page.get_response_code(url)
if response_code != requests.codes.ok:
bad_urls.append('%s is not a valid url - status code: %s.' % (url, response_code))
Assert.equal(0, len(bad_urls), '%s bad urls found: ' % len(bad_urls) + ', '.join(bad_urls))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment