Created
June 5, 2013 12:44
-
-
Save bobsilverberg/5713590 to your computer and use it in GitHub Desktop.
Example of using @pytest.mark.parametrize for mcom-tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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