File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ async def update(
180180 }
181181 )
182182
183- # Reset verification status
183+ customer . email = customer_update . email
184184 customer .email_verified = False
185185
186186 if (
@@ -220,7 +220,9 @@ async def update(
220220
221221 return await repository .update (
222222 customer ,
223- update_dict = customer_update .model_dump (exclude_unset = True , by_alias = True ),
223+ update_dict = customer_update .model_dump (
224+ exclude = {"email" }, exclude_unset = True , by_alias = True
225+ ),
224226 )
225227
226228 async def delete (self , session : AsyncSession , customer : Customer ) -> Customer :
Original file line number Diff line number Diff line change @@ -255,6 +255,18 @@ async def test_valid_same_external_id(
255255
256256 assert customer .external_id == customer_external_id .external_id
257257
258+ async def test_valid_explicitly_none_email (
259+ self , session : AsyncSession , customer : Customer
260+ ) -> None :
261+ updated_customer = await customer_service .update (
262+ session ,
263+ customer ,
264+ CustomerUpdate (email = None ),
265+ )
266+ await session .flush ()
267+
268+ assert updated_customer .email == customer .email
269+
258270
259271@pytest .mark .asyncio
260272class TestDelete :
You can’t perform that action at this time.
0 commit comments