Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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/"
Ejemplo n.º 3
0
 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/"
Ejemplo n.º 4
0
 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/"
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
 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