Skip to content

Commit

Permalink
Address the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
caroline-ttd committed Jul 12, 2024
1 parent e1933d0 commit d0c5db7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/test_identity_map_client_unit_tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base64
import json
import unittest
import datetime as dt
Expand All @@ -7,7 +8,7 @@


class IdentityMapUnitTests(unittest.TestCase):
UID2_SECRET_KEY = "wJ0hP19QU4hmpB64Y3fV2dAed8t/mupw3sjN5jNRFzg="
UID2_SECRET_KEY = base64.b64encode(b"UID2_CLIENT_SECRET").decode()
identity_map_client = IdentityMapClient("UID2_BASE_URL", "UID2_API_KEY", UID2_SECRET_KEY)

def test_identity_buckets_invalid_timestamp(self):
Expand Down Expand Up @@ -37,8 +38,7 @@ def test_get_datetime_utc_iso_format_timestamp(self):
@patch('uid2_client.identity_map_client.post')
@patch('uid2_client.identity_map_client.parse_v2_response')
def test_identity_buckets_request(self, mock_parse_v2_response, mock_post, mock_make_v2_request):
expected_timestamp = "2024-07-02T14:30:15.123456+00:00"
expected_req = json.dumps({"since_timestamp": get_datetime_utc_iso_format(dt.datetime.fromisoformat(expected_timestamp))}).encode()
expected_req = b'{"since_timestamp": "2024-07-02T14:30:15.123456"}'
test_cases = ["2024-07-02T14:30:15.123456+00:00", "2024-07-02 09:30:15.123456-05:00",
"2024-07-02T08:30:15.123456-06:00", "2024-07-02T10:30:15.123456-04:00",
"2024-07-02T06:30:15.123456-08:00", "2024-07-02T23:30:15.123456+09:00",
Expand All @@ -50,7 +50,6 @@ def test_identity_buckets_request(self, mock_parse_v2_response, mock_post, mock_
mock_response.read.return_value = b'{"mocked": "response"}'
mock_post.return_value = mock_response
mock_parse_v2_response.return_value = b'{"body":[],"status":"success"}'
print(expected_req)
for timestamp in test_cases:
self.identity_map_client.get_identity_buckets(dt.datetime.fromisoformat(timestamp))
called_args, called_kwargs = mock_make_v2_request.call_args
Expand Down

0 comments on commit d0c5db7

Please sign in to comment.