Added account_ids to the config
This commit is contained in:
@@ -131,7 +131,7 @@ def sample_wix_form_data():
|
||||
"contactId": f"contact-{unique_id}",
|
||||
},
|
||||
"field:anrede": "Mr.",
|
||||
"field:form_field_5a7b": "Checked",
|
||||
"field:form_field_5a7b": True,
|
||||
"field:date_picker_a7c8": "2024-12-25",
|
||||
"field:date_picker_7e65": "2024-12-31",
|
||||
"field:number_7cf5": "2",
|
||||
|
||||
@@ -249,27 +249,30 @@ async def test_hash_existing_customers_normalizes_country_code(
|
||||
hashed = result.scalar_one_or_none()
|
||||
assert hashed is None
|
||||
|
||||
# Verify the customer has the invalid country code
|
||||
# Verify the customer has the invalid country code stored in the DB
|
||||
assert customer.country_code == "Italy"
|
||||
|
||||
# Run hash_existing_customers - this should fail to validate "Italy"
|
||||
# because it's not a 2-letter code, so the customer should be skipped
|
||||
# Run hash_existing_customers - this should normalize "Italy" to "IT"
|
||||
# during validation and successfully create a hashed customer
|
||||
service = CustomerService(async_session)
|
||||
count = await service.hash_existing_customers()
|
||||
|
||||
# Should skip this customer due to validation error
|
||||
assert count == 0
|
||||
# Should successfully hash this customer (country code normalized during validation)
|
||||
assert count == 1
|
||||
|
||||
# Verify hashed version was NOT created
|
||||
# Verify hashed version was created
|
||||
await async_session.refresh(customer)
|
||||
result = await async_session.execute(
|
||||
select(HashedCustomer).where(HashedCustomer.customer_id == customer.id)
|
||||
)
|
||||
hashed = result.scalar_one_or_none()
|
||||
assert hashed is None
|
||||
assert hashed is not None
|
||||
|
||||
# The customer's country_code should still be "Italy" (unchanged)
|
||||
assert customer.country_code == "Italy"
|
||||
# The hashed customer should have the hashed version of normalized country code "IT"
|
||||
# "IT" -> lowercase "it" -> sha256 hash
|
||||
expected_hash = "2ad8a7049d7c5511ac254f5f51fe70a046ebd884729056f0fe57f5160d467153"
|
||||
assert hashed.hashed_country_code == expected_hash
|
||||
# Note: The original customer's country_code in DB remains "Italy" unchanged
|
||||
|
||||
# Now let's test the case where we have a valid 2-letter code
|
||||
# but in the wrong case (should be normalized to uppercase)
|
||||
@@ -290,7 +293,7 @@ async def test_hash_existing_customers_normalizes_country_code(
|
||||
# Run hash_existing_customers again
|
||||
count = await service.hash_existing_customers()
|
||||
|
||||
# Should hash this customer (country code will be normalized)
|
||||
# Should hash only the second customer (first one already hashed)
|
||||
assert count == 1
|
||||
|
||||
# Verify the customer's country_code was normalized to uppercase
|
||||
|
||||
Reference in New Issue
Block a user