diff --git a/scripts/browse.py b/scripts/browse.py index 810606a3..2edc156b 100644 --- a/scripts/browse.py +++ b/scripts/browse.py @@ -79,7 +79,7 @@ def scrape_links(url): # Check if the response contains an HTTP error if response.status_code >= 400: - return "error" + return "Error: HTTP " + str(response.status_code) + " error" soup = BeautifulSoup(response.text, "html.parser") diff --git a/tests/test_browse_scrape_links.py b/tests/test_browse_scrape_links.py index 908e43b9..48d74167 100644 --- a/tests/test_browse_scrape_links.py +++ b/tests/test_browse_scrape_links.py @@ -72,7 +72,7 @@ class TestScrapeLinks: result = scrape_links("https://www.invalidurl.com") # Assert that the function returns "error" - assert result == "error" + assert "Error:" in result # Tests that the function returns an empty list when the html contains no hyperlinks. def test_no_hyperlinks(self, mocker):