1616 users_pre_registration_details ,
1717)
1818from simcore_service_webserver .db .plugin import get_asyncpg_engine
19- from simcore_service_webserver .users import _users_repository
19+ from simcore_service_webserver .users import _accounts_repository
2020
2121
2222@pytest .fixture
@@ -62,7 +62,7 @@ async def test_create_user_pre_registration(
6262 }
6363
6464 # Act
65- pre_registration_id = await _users_repository .create_user_pre_registration (
65+ pre_registration_id = await _accounts_repository .create_user_pre_registration (
6666 asyncpg_engine ,
6767 email = test_email ,
6868 created_by = created_by_user_id ,
@@ -112,7 +112,7 @@ async def test_review_user_pre_registration(
112112 }
113113
114114 # Create a pre-registration to review
115- pre_registration_id = await _users_repository .create_user_pre_registration (
115+ pre_registration_id = await _accounts_repository .create_user_pre_registration (
116116 asyncpg_engine ,
117117 email = test_email ,
118118 created_by = created_by_user_id ,
@@ -125,15 +125,15 @@ async def test_review_user_pre_registration(
125125
126126 # Act - review and approve the registration
127127 new_status = AccountRequestStatus .APPROVED
128- await _users_repository .review_user_pre_registration (
128+ await _accounts_repository .review_user_pre_registration (
129129 asyncpg_engine ,
130130 pre_registration_id = pre_registration_id ,
131131 reviewed_by = reviewer_id ,
132132 new_status = new_status ,
133133 )
134134
135135 # Assert - Use list_user_pre_registrations to verify
136- registrations , count = await _users_repository .list_user_pre_registrations (
136+ registrations , count = await _accounts_repository .list_user_pre_registrations (
137137 asyncpg_engine ,
138138 filter_by_pre_email = test_email ,
139139 filter_by_product_name = product_name ,
@@ -190,7 +190,7 @@ async def test_review_user_pre_registration_with_invitation_extras(
190190 }
191191
192192 # Create a pre-registration to review
193- pre_registration_id = await _users_repository .create_user_pre_registration (
193+ pre_registration_id = await _accounts_repository .create_user_pre_registration (
194194 asyncpg_engine ,
195195 email = test_email ,
196196 created_by = created_by_user_id ,
@@ -215,7 +215,7 @@ async def test_review_user_pre_registration_with_invitation_extras(
215215
216216 # Act - review and approve the registration with invitation extras
217217 new_status = AccountRequestStatus .APPROVED
218- await _users_repository .review_user_pre_registration (
218+ await _accounts_repository .review_user_pre_registration (
219219 asyncpg_engine ,
220220 pre_registration_id = pre_registration_id ,
221221 reviewed_by = reviewer_id ,
@@ -224,7 +224,7 @@ async def test_review_user_pre_registration_with_invitation_extras(
224224 )
225225
226226 # Assert - Use list_user_pre_registrations to verify
227- registrations , count = await _users_repository .list_user_pre_registrations (
227+ registrations , count = await _accounts_repository .list_user_pre_registrations (
228228 asyncpg_engine ,
229229 filter_by_pre_email = test_email ,
230230 filter_by_product_name = product_name ,
@@ -281,7 +281,7 @@ async def test_list_user_pre_registrations(
281281
282282 # Create pending registrations
283283 for i , email in enumerate (emails [:3 ]):
284- pre_reg_id = await _users_repository .create_user_pre_registration (
284+ pre_reg_id = await _accounts_repository .create_user_pre_registration (
285285 asyncpg_engine ,
286286 email = email ,
287287 created_by = created_by_user_id ,
@@ -295,15 +295,15 @@ async def test_list_user_pre_registrations(
295295 pre_registration_details_db_cleanup .append (pre_reg_id )
296296
297297 # Create and approve one registration
298- await _users_repository .review_user_pre_registration (
298+ await _accounts_repository .review_user_pre_registration (
299299 asyncpg_engine ,
300300 pre_registration_id = pre_reg_ids [0 ],
301301 reviewed_by = created_by_user_id ,
302302 new_status = AccountRequestStatus .APPROVED ,
303303 )
304304
305305 # Create and reject one registration
306- await _users_repository .review_user_pre_registration (
306+ await _accounts_repository .review_user_pre_registration (
307307 asyncpg_engine ,
308308 pre_registration_id = pre_reg_ids [1 ],
309309 reviewed_by = created_by_user_id ,
@@ -315,15 +315,15 @@ async def test_list_user_pre_registrations(
315315 # Act & Assert - Test different filter combinations
316316
317317 # 1. Get all registrations (should be 3)
318- all_registrations , count = await _users_repository .list_user_pre_registrations (
318+ all_registrations , count = await _accounts_repository .list_user_pre_registrations (
319319 asyncpg_engine ,
320320 filter_by_product_name = product_name ,
321321 )
322322 assert count == 3
323323 assert len (all_registrations ) == 3
324324
325325 # 2. Filter by email pattern (should match first 3 emails with "test")
326- test_registrations , count = await _users_repository .list_user_pre_registrations (
326+ test_registrations , count = await _accounts_repository .list_user_pre_registrations (
327327 asyncpg_engine ,
328328 filter_by_pre_email = "test" ,
329329 filter_by_product_name = product_name ,
@@ -333,10 +333,12 @@ async def test_list_user_pre_registrations(
333333 assert all ("test" in reg ["pre_email" ] for reg in test_registrations )
334334
335335 # 3. Filter by status - APPROVED
336- approved_registrations , count = await _users_repository .list_user_pre_registrations (
337- asyncpg_engine ,
338- filter_by_account_request_status = AccountRequestStatus .APPROVED ,
339- filter_by_product_name = product_name ,
336+ approved_registrations , count = (
337+ await _accounts_repository .list_user_pre_registrations (
338+ asyncpg_engine ,
339+ filter_by_account_request_status = AccountRequestStatus .APPROVED ,
340+ filter_by_product_name = product_name ,
341+ )
340342 )
341343 assert count == 1
342344 assert len (approved_registrations ) == 1
@@ -347,10 +349,12 @@ async def test_list_user_pre_registrations(
347349 )
348350
349351 # 4. Filter by status - REJECTED
350- rejected_registrations , count = await _users_repository .list_user_pre_registrations (
351- asyncpg_engine ,
352- filter_by_account_request_status = AccountRequestStatus .REJECTED ,
353- filter_by_product_name = product_name ,
352+ rejected_registrations , count = (
353+ await _accounts_repository .list_user_pre_registrations (
354+ asyncpg_engine ,
355+ filter_by_account_request_status = AccountRequestStatus .REJECTED ,
356+ filter_by_product_name = product_name ,
357+ )
354358 )
355359 assert count == 1
356360 assert len (rejected_registrations ) == 1
@@ -361,10 +365,12 @@ async def test_list_user_pre_registrations(
361365 )
362366
363367 # 5. Filter by status - PENDING
364- pending_registrations , count = await _users_repository .list_user_pre_registrations (
365- asyncpg_engine ,
366- filter_by_account_request_status = AccountRequestStatus .PENDING ,
367- filter_by_product_name = product_name ,
368+ pending_registrations , count = (
369+ await _accounts_repository .list_user_pre_registrations (
370+ asyncpg_engine ,
371+ filter_by_account_request_status = AccountRequestStatus .PENDING ,
372+ filter_by_product_name = product_name ,
373+ )
368374 )
369375 assert count == 1
370376 assert len (pending_registrations ) == 1
@@ -376,7 +382,7 @@ async def test_list_user_pre_registrations(
376382
377383 # 6. Test pagination
378384 paginated_registrations , count = (
379- await _users_repository .list_user_pre_registrations (
385+ await _accounts_repository .list_user_pre_registrations (
380386 asyncpg_engine ,
381387 filter_by_product_name = product_name ,
382388 pagination_limit = 2 ,
@@ -387,7 +393,7 @@ async def test_list_user_pre_registrations(
387393 assert len (paginated_registrations ) == 2 # But only returns 2 records
388394
389395 # Get next page
390- page2_registrations , count = await _users_repository .list_user_pre_registrations (
396+ page2_registrations , count = await _accounts_repository .list_user_pre_registrations (
391397 asyncpg_engine ,
392398 filter_by_product_name = product_name ,
393399 pagination_limit = 2 ,
@@ -425,7 +431,7 @@ async def test_create_pre_registration_with_existing_user_linking(
425431 existing_user_email = product_owner_user ["email" ]
426432
427433 # Act - Create pre-registration with the same email as product_owner_user
428- pre_registration_id = await _users_repository .create_user_pre_registration (
434+ pre_registration_id = await _accounts_repository .create_user_pre_registration (
429435 asyncpg_engine ,
430436 email = existing_user_email , # Same email as existing user
431437 created_by = existing_user_id ,
@@ -440,7 +446,7 @@ async def test_create_pre_registration_with_existing_user_linking(
440446 pre_registration_details_db_cleanup .append (pre_registration_id )
441447
442448 # Assert - Verify through list_user_pre_registrations
443- registrations , count = await _users_repository .list_user_pre_registrations (
449+ registrations , count = await _accounts_repository .list_user_pre_registrations (
444450 asyncpg_engine ,
445451 filter_by_pre_email = existing_user_email ,
446452 filter_by_product_name = product_name ,
@@ -502,7 +508,7 @@ async def mixed_user_data(
502508
503509 # 1. Create a pre-registered user that is not in the users table - PENDING status
504510 pre_reg_email = "[email protected] " 505- pre_reg_id = await _users_repository .create_user_pre_registration (
511+ pre_reg_id = await _accounts_repository .create_user_pre_registration (
506512 asyncpg_engine ,
507513 email = pre_reg_email ,
508514 created_by = created_by_user_id ,
@@ -521,7 +527,7 @@ async def mixed_user_data(
521527 pre_registration_details_db_cleanup .append (pre_reg_id )
522528
523529 # 2. Create a pre-registration for the product_owner_user (both registered and pre-registered)
524- owner_pre_reg_id = await _users_repository .create_user_pre_registration (
530+ owner_pre_reg_id = await _accounts_repository .create_user_pre_registration (
525531 asyncpg_engine ,
526532 email = product_owner_user ["email" ],
527533 created_by = created_by_user_id ,
@@ -537,7 +543,7 @@ async def mixed_user_data(
537543
538544 # 3. Create another pre-registered user with APPROVED status
539545 approved_email = "[email protected] " 540- approved_reg_id = await _users_repository .create_user_pre_registration (
546+ approved_reg_id = await _accounts_repository .create_user_pre_registration (
541547 asyncpg_engine ,
542548 email = approved_email ,
543549 created_by = created_by_user_id ,
@@ -551,7 +557,7 @@ async def mixed_user_data(
551557 pre_registration_details_db_cleanup .append (approved_reg_id )
552558
553559 # Set to APPROVED status
554- await _users_repository .review_user_pre_registration (
560+ await _accounts_repository .review_user_pre_registration (
555561 asyncpg_engine ,
556562 pre_registration_id = approved_reg_id ,
557563 reviewed_by = created_by_user_id ,
@@ -582,7 +588,7 @@ async def test_list_merged_users_all_users(
582588
583589 # Act - Get all users without filtering
584590 users_list , total_count = (
585- await _users_repository .list_merged_pre_and_registered_users (
591+ await _accounts_repository .list_merged_pre_and_registered_users (
586592 asyncpg_engine ,
587593 product_name = product_name ,
588594 filter_include_deleted = False ,
@@ -618,7 +624,7 @@ async def test_list_merged_users_pre_registered_only(
618624 asyncpg_engine = get_asyncpg_engine (app )
619625
620626 # Act - Get all users
621- users_list , _ = await _users_repository .list_merged_pre_and_registered_users (
627+ users_list , _ = await _accounts_repository .list_merged_pre_and_registered_users (
622628 asyncpg_engine ,
623629 product_name = product_name ,
624630 filter_include_deleted = False ,
@@ -654,7 +660,7 @@ async def test_list_merged_users_linked_user(
654660 asyncpg_engine = get_asyncpg_engine (app )
655661
656662 # Act - Get all users
657- users_list , _ = await _users_repository .list_merged_pre_and_registered_users (
663+ users_list , _ = await _accounts_repository .list_merged_pre_and_registered_users (
658664 asyncpg_engine ,
659665 product_name = product_name ,
660666 filter_include_deleted = False ,
@@ -705,7 +711,7 @@ async def test_list_merged_users_filter_pending(
705711
706712 # Act - Get users with PENDING status
707713 pending_users , pending_count = (
708- await _users_repository .list_merged_pre_and_registered_users (
714+ await _accounts_repository .list_merged_pre_and_registered_users (
709715 asyncpg_engine ,
710716 product_name = product_name ,
711717 filter_any_account_request_status = [AccountRequestStatus .PENDING ],
@@ -734,7 +740,7 @@ async def test_list_merged_users_filter_approved(
734740
735741 # Act - Get users with APPROVED status
736742 approved_users , approved_count = (
737- await _users_repository .list_merged_pre_and_registered_users (
743+ await _accounts_repository .list_merged_pre_and_registered_users (
738744 asyncpg_engine ,
739745 product_name = product_name ,
740746 filter_any_account_request_status = [AccountRequestStatus .APPROVED ],
@@ -760,7 +766,7 @@ async def test_list_merged_users_multiple_statuses(
760766
761767 # Act - Get users with either PENDING or APPROVED status
762768 mixed_status_users , mixed_status_count = (
763- await _users_repository .list_merged_pre_and_registered_users (
769+ await _accounts_repository .list_merged_pre_and_registered_users (
764770 asyncpg_engine ,
765771 product_name = product_name ,
766772 filter_any_account_request_status = [
@@ -791,7 +797,7 @@ async def test_list_merged_users_pagination(
791797
792798 # Act - Get first page with limit 2
793799 page1_users , total_count = (
794- await _users_repository .list_merged_pre_and_registered_users (
800+ await _accounts_repository .list_merged_pre_and_registered_users (
795801 asyncpg_engine ,
796802 product_name = product_name ,
797803 filter_include_deleted = False ,
@@ -801,7 +807,7 @@ async def test_list_merged_users_pagination(
801807 )
802808
803809 # Get second page with limit 2
804- page2_users , _ = await _users_repository .list_merged_pre_and_registered_users (
810+ page2_users , _ = await _accounts_repository .list_merged_pre_and_registered_users (
805811 asyncpg_engine ,
806812 product_name = product_name ,
807813 filter_include_deleted = False ,
0 commit comments