def test_clean_url_values(): """ test case to clean the URL values from the Cisco API response :return: """ test_sets = { # input, expected "": "", " ": "", "http://localhost ": "http://localhost", "http://localhost": "http://localhost", "https://localhost": "https://localhost", "https://localhost;http://another_localhost": "https://localhost", "https://localhost and http://another_localhost": "https://localhost", "https://localhost and https://another_localhost": "https://localhost", "https://localhost; and http://another_localhost": "https://localhost", "https://localhost; and https://another_localhost": "https://localhost", "https://localhost http://another_localhost": "https://localhost", "https://localhost https://another_localhost": "https://localhost", "https://localhost or http://another_localhost": "https://localhost", "https://localhost or https://another_localhost": "https://localhost", "https://localhost; or http://another_localhost": "https://localhost", "https://localhost; or https://another_localhost": "https://localhost", } for input, exp_output in test_sets.items(): output = api_crawler.clean_api_url_response(input) assert output == exp_output
def test_clean_url_values(self): test_sets = { # input, expected "": "", " ": "", "http://localhost": "http://localhost", "https://localhost": "https://localhost", "https://localhost;http://another_localhost": "https://localhost", "https://localhost and http://another_localhost": "https://localhost", "https://localhost and https://another_localhost": "https://localhost", "https://localhost; and http://another_localhost": "https://localhost", "https://localhost; and https://another_localhost": "https://localhost", "https://localhost http://another_localhost": "https://localhost", "https://localhost https://another_localhost": "https://localhost", "https://localhost or http://another_localhost": "https://localhost", "https://localhost or https://another_localhost": "https://localhost", "https://localhost; or http://another_localhost": "https://localhost", "https://localhost; or https://another_localhost": "https://localhost", } for input, exp_output in test_sets.items(): output = api_crawler.clean_api_url_response(input) assert output == exp_output