@@ -135,21 +135,23 @@ def test_identity_map_hashed_phones(self):
135135 def test_identity_map_client_bad_url (self ):
136136 identity_map_input = IdentityMapInput .from_emails (
137137 ["hopefully-not-opted-out@example.com" , "somethingelse@example.com" , "optout@example.com" ])
138- client = IdentityMapClient ("https://operator-bad-url.uidapi.com" , os .getenv ("UID2_API_KEY" ), os .getenv ("UID2_SECRET_KEY" ))
138+ client = IdentityMapClient ("https://operator-bad-url.uidapi.com" , os .getenv ("UID2_API_KEY" ),
139+ os .getenv ("UID2_SECRET_KEY" ))
139140 self .assertRaises (requests .exceptions .ConnectionError , client .generate_identity_map , identity_map_input )
140141 self .assertRaises (requests .exceptions .ConnectionError , client .get_identity_buckets , datetime .datetime .now ())
141142
142143 def test_identity_map_client_bad_api_key (self ):
143144 identity_map_input = IdentityMapInput .from_emails (
144145 ["hopefully-not-opted-out@example.com" , "somethingelse@example.com" , "optout@example.com" ])
145146 client = IdentityMapClient (os .getenv ("UID2_BASE_URL" ), "bad-api-key" , os .getenv ("UID2_SECRET_KEY" ))
146- self .assertRaises (requests .exceptions .HTTPError , client .generate_identity_map ,identity_map_input )
147+ self .assertRaises (requests .exceptions .HTTPError , client .generate_identity_map , identity_map_input )
147148 self .assertRaises (requests .exceptions .HTTPError , client .get_identity_buckets , datetime .datetime .now ())
148149
149150 def test_identity_map_client_bad_secret (self ):
150151 identity_map_input = IdentityMapInput .from_emails (
151152 ["hopefully-not-opted-out@example.com" , "somethingelse@example.com" , "optout@example.com" ])
152- client = IdentityMapClient (os .getenv ("UID2_BASE_URL" ), os .getenv ("UID2_API_KEY" ), "wJ0hP19QU4hmpB64Y3fV2dAed8t/mupw3sjN5jNRFzg=" )
153+ client = IdentityMapClient (os .getenv ("UID2_BASE_URL" ), os .getenv ("UID2_API_KEY" ),
154+ "wJ0hP19QU4hmpB64Y3fV2dAed8t/mupw3sjN5jNRFzg=" )
153155 self .assertRaises (requests .exceptions .HTTPError , client .generate_identity_map ,
154156 identity_map_input )
155157 self .assertRaises (requests .exceptions .HTTPError , client .get_identity_buckets ,
@@ -182,8 +184,16 @@ def test_identity_buckets_empty_response(self):
182184 self .assertTrue (response .is_success )
183185
184186 def test_identity_buckets_invalid_timestamp (self ):
185- self .assertRaises (TypeError , self .identity_map_client .get_identity_buckets ,
186- "1234567890" )
187+ test_cases = ["1234567890" ,
188+ 1234567890 ,
189+ 2024.7 ,
190+ "2024-7-1" ,
191+ "2024-07-01T12:00:00" ,
192+ [2024 , 7 , 1 , 12 , 0 , 0 ],
193+ None ]
194+ for timestamp in test_cases :
195+ self .assertRaises (AttributeError , self .identity_map_client .get_identity_buckets ,
196+ timestamp )
187197
188198
189199if __name__ == '__main__' :
0 commit comments