def test_qed_leftlinks(): test_name = "Test of Ubertool Mainpage Left Column Links " try: # verify that all links on a model page produce status code of 200 for main_server in servers: response = requests.get(main_server + "/ubertool") soup_content = BeautifulSoup(response.content, "html.parser") div_tags_left = soup_content.find_all('div', {'class': 'left'}) # assuming a single div/class by this name left_links = div_tags_left[0].find_all('a') if left_links: assert_error = False link_url = [""] * len(left_links) status = [""] * len(left_links) link_url = linkcheck_helper.build_http_links(main_server, left_links) status = linkcheck_helper.status_chk(link_url) try: npt.assert_array_equal(status, 200, '200 error', True) except AssertionError: assert_error = True except Exception as e: # handle any other exception print "Error '{0}' occured. Arguments {1}.".format(e.message, e.args) except Exception as e: # handle any other exception print "Error '{0}' occured. Arguments {1}.".format(e.message, e.args) finally: linkcheck_helper.write_report(test_name, assert_error, link_url, status) return
def test_qed_mainpagelinks(): try: # verify that all links on a model page (main article section) produce status code of 200 test_name = "Model Mainpage Article Links " for page in model_tab_pages: response = requests.get(page) soup_content = BeautifulSoup(response.content, "html.parser") div_tag_article = soup_content.find_all('div', {'class': 'articles'}) # assuming a single div/class by this name if div_tag_article: article_links = div_tag_article[0].find_all('a') if article_links: link_url = [""] * len(article_links) status = [""] * len(article_links) link_url = linkcheck_helper.build_http_links(page, article_links) status = linkcheck_helper.status_chk(link_url) try: npt.assert_array_equal(status, 200, '200 error', True) except AssertionError: assert_error = True except Exception as e: # handle any other exception print "Error '{0}' occured. Arguments {1}.".format(e.message, e.args) finally: linkcheck_helper.write_report(test_name, assert_error, link_url, status) except Exception as e: # handle any other exception print "Error '{0}' occured. Arguments {1}.".format(e.message, e.args) return