@@ -58,6 +58,16 @@ def test_fetch_links(mock_get):
5858 with open (result_file , "w" ) as file :
5959 json .dump (links , file , indent = 4 )
6060 check_json_results (result_file , expected_file , clean = False )
61+ #Testing relative links
62+ realtive_links_file = test_env .get_test_loc ("fetch_links_test.html" )
63+ with open (realtive_links_file ) as realtive_file :
64+ mock_get .return_value = realtive_file .read ()
65+ relative_links = PypiSimpleRepository ().fetch_links (normalized_name = "" )
66+ relative_links_result_file = test_env .get_temp_file ("json" )
67+ relative_links_expected_file = test_env .get_test_loc ("relative-links-expected.json" , must_exist = False )
68+ with open (relative_links_result_file , "w" ) as file :
69+ json .dump (links , file , indent = 4 )
70+ check_json_results (relative_links_result_file , relative_links_expected_file , clean = False )
6171
6272
6373def test_parse_reqs ():
@@ -99,3 +109,11 @@ def test_parse_reqs_with_setup_requires_and_python_requires():
99109def test_valid_python_version ():
100110 assert valid_python_version ("3.8" , ">3.1" )
101111 assert not valid_python_version ("3.8.1" , ">3.9" )
112+
113+
114+ # def test_parsing_relative_urls():
115+ # self.index_url= test_fetch_links ("tests/data/fetch_links_test.html")
116+ # normalized_name=""
117+ # simple=PypiSimpleRepository()
118+ # assert simple.fetch_links(normalized_name)==""
119+
0 commit comments