Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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)