-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ab20bb
commit 890557a
Showing
5 changed files
with
19 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,21 +135,23 @@ def test_identity_map_hashed_phones(self): | |
def test_identity_map_client_bad_url(self): | ||
identity_map_input = IdentityMapInput.from_emails( | ||
["[email protected]", "[email protected]", "[email protected]"]) | ||
client = IdentityMapClient("https://operator-bad-url.uidapi.com", os.getenv("UID2_API_KEY"), os.getenv("UID2_SECRET_KEY")) | ||
client = IdentityMapClient("https://operator-bad-url.uidapi.com", os.getenv("UID2_API_KEY"), | ||
os.getenv("UID2_SECRET_KEY")) | ||
self.assertRaises(requests.exceptions.ConnectionError, client.generate_identity_map, identity_map_input) | ||
self.assertRaises(requests.exceptions.ConnectionError, client.get_identity_buckets, datetime.datetime.now()) | ||
|
||
def test_identity_map_client_bad_api_key(self): | ||
identity_map_input = IdentityMapInput.from_emails( | ||
["[email protected]", "[email protected]", "[email protected]"]) | ||
client = IdentityMapClient(os.getenv("UID2_BASE_URL"), "bad-api-key", os.getenv("UID2_SECRET_KEY")) | ||
self.assertRaises(requests.exceptions.HTTPError, client.generate_identity_map,identity_map_input) | ||
self.assertRaises(requests.exceptions.HTTPError, client.generate_identity_map, identity_map_input) | ||
self.assertRaises(requests.exceptions.HTTPError, client.get_identity_buckets, datetime.datetime.now()) | ||
|
||
def test_identity_map_client_bad_secret(self): | ||
identity_map_input = IdentityMapInput.from_emails( | ||
["[email protected]", "[email protected]", "[email protected]"]) | ||
client = IdentityMapClient(os.getenv("UID2_BASE_URL"), os.getenv("UID2_API_KEY"), "wJ0hP19QU4hmpB64Y3fV2dAed8t/mupw3sjN5jNRFzg=") | ||
client = IdentityMapClient(os.getenv("UID2_BASE_URL"), os.getenv("UID2_API_KEY"), | ||
"wJ0hP19QU4hmpB64Y3fV2dAed8t/mupw3sjN5jNRFzg=") | ||
self.assertRaises(requests.exceptions.HTTPError, client.generate_identity_map, | ||
identity_map_input) | ||
self.assertRaises(requests.exceptions.HTTPError, client.get_identity_buckets, | ||
|
@@ -182,8 +184,16 @@ def test_identity_buckets_empty_response(self): | |
self.assertTrue(response.is_success) | ||
|
||
def test_identity_buckets_invalid_timestamp(self): | ||
self.assertRaises(TypeError, self.identity_map_client.get_identity_buckets, | ||
"1234567890") | ||
test_cases = ["1234567890", | ||
1234567890, | ||
2024.7, | ||
"2024-7-1", | ||
"2024-07-01T12:00:00", | ||
[2024, 7, 1, 12, 0, 0], | ||
None] | ||
for timestamp in test_cases: | ||
self.assertRaises(AttributeError, self.identity_map_client.get_identity_buckets, | ||
timestamp) | ||
|
||
|
||
if __name__ == '__main__': | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters