Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'method': 'POST',
'authorization': _basic_auth_str('siteid', 'apikey'),
'content_type': 'application/json',
'url_suffix': '/segments/1/remove_customers',
'body': {'ids': ['1','2','3']},
}))
self.cio.remove_from_segment(segment_id=1, customer_ids=[1,2,3])
with self.assertRaises(CustomerIOException):
self.cio.remove_from_segment(None, None)
with self.assertRaises(CustomerIOException):
self.cio.add_to_segment(segment_id=1, customer_ids=False)
with self.assertRaises(CustomerIOException):
self.cio.add_to_segment(segment_id=1, customer_ids=[False,True,False])
def test_client_connection_handling(self):
retries = self.cio.retries
# should not raise exception as i should be less than retries and
# therefore the last request should return a valid response
for i in range(retries):
self.cio.identify(i, fail_count=i)
# should raise expection as we get invalid responses for all retries
with self.assertRaises(CustomerIOException):
self.cio.identify(retries, fail_count=retries)