Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.cio = CustomerIO(
site_id='siteid',
api_key='apikey',
host=self.server.server_address[0],
port=self.server.server_port,
retries=5,
backoff_factor=0)
# do not verify the ssl certificate as it is self signed
# should only be done for tests
self.cio.http.verify = False
def test_base_url(self):
test_cases = [
# host, port, prefix, result
(None, None, None, 'https://track.customer.io/api/v1'),
(None, None, 'v2', 'https://track.customer.io/v2'),
(None, None, '/v2/', 'https://track.customer.io/v2'),
('sub.domain.com', 1337, '/v2/', 'https://sub.domain.com:1337/v2'),
('/sub.domain.com/', 1337, '/v2/', 'https://sub.domain.com:1337/v2'),
('http://sub.domain.com/', 1337, '/v2/', 'https://sub.domain.com:1337/v2'),
]
for host, port, prefix, result in test_cases:
cio = CustomerIO(host=host, port=port, url_prefix=prefix)
self.assertEqual(cio.base_url, result)