def test_full_parse(self, name, count, expected_item): index_html = importlib_resources.read_text(simple_data, f"index.{name}.html") index = simple.parse_repo_index(index_html) assert len(index) == count key, value = expected_item assert key in index assert index[key] == value
def test_relative_url(self): index_html = """ <html> <body> <a href="django-node">django-node</a> </body> </html> """ index = simple.parse_repo_index(index_html) assert index["django-node"] == "django-node/"
def test_project_name_not_normalized(self): index_html = """ <html> <body> <a href="/project/package-name">PACKAGE-NAME</a> </body> </html> """ index = simple.parse_repo_index(index_html) assert index["PACKAGE-NAME"] == "/project/package-name/"
def test_project_url_normalization_complete(self): index_html = """ <html> <body> <a href="/project/PACKAGE-NAME">package-name</a> </body> </html> """ index = simple.parse_repo_index(index_html) assert index["package-name"] == "/project/package-name/"
def test_no_href(self): index_html = "<html><head></head><body><a>my-cdata-package</a></body></html>" index = simple.parse_repo_index(index_html) assert not index
def test_no_cdata(self): index_html = ( "<html><head></head><body><a href='https://no.url/here'></a></body></html>" ) index = simple.parse_repo_index(index_html) assert not index