def test_to_url_with_unicode_chars_in_API_key(self): API_key = '£°test££' API_endpoint = 'http://%s.openweathermap.org/data/2.5/ep' api_subscription = 'free' result = HttpClient.to_url(API_endpoint, API_key, api_subscription) expected = 'http://api.openweathermap.org/data/2.5/ep?APPID=%C2%A3%C2%B0test%C2%A3%C2%A3' self.assertEqual(expected, result)
def test_to_url_with_no_API_key(self): API_endpoint = 'http://%s.openweathermap.org/data/2.5/ep' params = {'a': 1, 'b': 2} api_subscription = 'pro' result = HttpClient.to_url(API_endpoint, None, api_subscription) expected = 'http://pro.openweathermap.org/data/2.5/ep' self.assertEqual(expected, result)
def test_to_url(self): API_endpoint = 'http://%s.openweathermap.org/data/2.5/ep' API_key = 'test_API_key' api_subscription = 'free' result = HttpClient.to_url(API_endpoint, API_key, api_subscription) expected = 'http://api.openweathermap.org/data/2.5/ep?APPID=test_API_key' self.assertEqual(expected, expected)