|
2 | 2 |
|
3 | 3 | from tests.uid2_token_generator import UID2TokenGenerator, Params |
4 | 4 | from uid2_client import * |
| 5 | +from uid2_client.encryption import _encrypt_token |
5 | 6 | from uid2_client.identity_scope import IdentityScope |
6 | 7 | from uid2_client.identity_type import IdentityType |
7 | 8 | from uid2_client.keys import * |
@@ -337,6 +338,22 @@ def test_decrypt_token_v2_custom_now(self): |
337 | 338 | result = decrypt(token, keys, now=expiry - dt.timedelta(seconds=1)) |
338 | 339 | self.assertEqual(_example_id, result.uid2) |
339 | 340 |
|
| 341 | + def test_smoke_token_v3(self): |
| 342 | + uid2 = _example_id |
| 343 | + identity_scope = IdentityScope.UID2 |
| 344 | + now = dt.datetime.now(tz=timezone.utc) |
| 345 | + |
| 346 | + keys = EncryptionKeysCollection([_master_key, _site_key, _keyset_key], default_keyset_id=20, |
| 347 | + master_keyset_id=9999, caller_site_id=20) |
| 348 | + |
| 349 | + result = _encrypt_token(uid2, identity_scope, _master_key, _site_key, _site_id, now=now, |
| 350 | + token_expiry=now + dt.timedelta(days=30) if keys.get_token_expiry_seconds() is None \ |
| 351 | + else now + dt.timedelta(seconds=int(keys.get_token_expiry_seconds())), |
| 352 | + ad_token_version=AdvertisingTokenVersion.ADVERTISING_TOKEN_V3) |
| 353 | + final = decrypt(result, keys, now=now) |
| 354 | + |
| 355 | + self.assertEqual(uid2, final.uid2) |
| 356 | + |
340 | 357 | def test_smoke_token_v4(self): |
341 | 358 | uid2 = _example_id |
342 | 359 | identity_scope = IdentityScope.UID2 |
|
0 commit comments