Пример #1
0
 def test_hipaa_enabled(self):
     client = GeocodioClient(self.TEST_API_KEY,
                             hipaa_enabled=True,
                             auto_load_api_version=False)
     self.assertTrue(client.hipaa_enabled)
     self.assertTrue(
         client.BASE_URL.startswith("https://api-hipaa.geocod.io"))
Пример #2
0
 def test_default_version(self):
     client = GeocodioClient(self.TEST_API_KEY, auto_load_api_version=False)
     self.assertTrue(
         client.BASE_URL.startswith(
             "https://api.geocod.io/v{version}".format(
                 version=DEFAULT_API_VERSION)))
     self.assertEqual(client.version, DEFAULT_API_VERSION)
Пример #3
0
 def setUp(self):
     self.TEST_API_KEY = "1010110101"
     self.parse_url = "https://api.geocod.io/v{api_version}/parse".format(
         api_version=DEFAULT_API_VERSION)
     self.geocode_url = "https://api.geocod.io/v{api_version}/geocode".format(
         api_version=DEFAULT_API_VERSION)
     self.reverse_url = "https://api.geocod.io/v{api_version}/reverse".format(
         api_version=DEFAULT_API_VERSION)
     self.client = GeocodioClient(self.TEST_API_KEY)
     self.err = '{"error": "We are testing"}'
Пример #4
0
 def test_auto_load_hipaa_api_version(self):
     httpretty.register_uri(httpretty.GET,
                            self.base_hipaa_domain,
                            body=self.api_description,
                            status=200)
     client = GeocodioClient(self.TEST_API_KEY, hipaa_enabled=True)
     expected_version = "1.6"
     self.assertEqual(client.version, expected_version)
     self.assertTrue(
         client.BASE_URL.startswith("{domain}/v{version}".format(
             domain=self.base_hipaa_domain, version=expected_version)))
Пример #5
0
 def test_auto_load_failure(self):
     httpretty.register_uri(httpretty.GET,
                            self.base_domain,
                            body="does not matter",
                            status=500)
     client = GeocodioClient(self.TEST_API_KEY)
     expected_version = DEFAULT_API_VERSION
     self.assertEqual(client.version, expected_version)
     self.assertTrue(
         client.BASE_URL.startswith("{domain}/v{version}".format(
             domain=self.base_domain, version=expected_version)))
Пример #6
0
 def setUp(self):
     self.TEST_API_KEY = "1010110101"
     self.parse_url = "https://api.geocod.io/v{api_version}/parse".format(
         api_version=DEFAULT_API_VERSION)
     self.geocode_url = "https://api.geocod.io/v{api_version}/geocode".format(
         api_version=DEFAULT_API_VERSION)
     self.reverse_url = "https://api.geocod.io/v{api_version}/reverse".format(
         api_version=DEFAULT_API_VERSION)
     # WARNING - Client will ignore auto-loading api version for all tests using the fixture
     self.client = GeocodioClient(self.TEST_API_KEY,
                                  auto_load_api_version=False)
     self.err = '{"error": "We are testing"}'
Пример #7
0
 def test_skip_auto_load_if_disabled(self):
     httpretty.register_uri(httpretty.GET,
                            self.base_domain,
                            body=self.api_description,
                            status=200)
     expected_version = DEFAULT_API_VERSION
     client = GeocodioClient(self.TEST_API_KEY, auto_load_api_version=False)
     self.assertEqual(client.version, expected_version)
     self.assertTrue(
         client.BASE_URL.startswith("{domain}/v{version}".format(
             domain=self.base_domain, version=expected_version)))
     self.assertEqual(len(httpretty.latest_requests()), 0)
Пример #8
0
 def setUp(self):
     self.parse_url = "http://api.geocod.io/v1/parse"
     self.geocode_url = "http://api.geocod.io/v1/geocode"
     self.reverse_url = "http://api.geocod.io/v1/reverse"
     self.client = GeocodioClient("1010110101")
     self.err = '{"error": "We are testing"}'
Пример #9
0
 def test_diff_version(self):
     client = GeocodioClient(self.TEST_API_KEY, version="1.0")
     self.assertTrue(
         client.BASE_URL.startswith("https://api.geocod.io/v1.0"))
     self.assertEqual(client.version, "1.0")
Пример #10
0
 def test_hipaa_disabled(self):
     client = GeocodioClient(self.TEST_API_KEY)
     self.assertFalse(client.hipaa_enabled)
     self.assertTrue(client.BASE_URL.startswith("https://api.geocod.io"))
Пример #11
0
 def test_hipaa_enabled(self):
     client = GeocodioClient("1010110101", hipaa_enabled=True)
     self.assertTrue(client.hipaa_enabled)
     self.assertTrue(
         client.BASE_URL.startswith("https://api-hipaa.geocod.io"))