@@ -80,32 +80,39 @@ async def test_insert(auth_db: AuthDB):
8080async def test_clean_authorization_flows (auth_db : AuthDB ):
8181 # Insert two authorization flows
8282 async with auth_db as auth_db :
83- uuid1 = await auth_db .insert_authorization_flow (
83+ _ = await auth_db .insert_authorization_flow (
8484 "client_id" , "scope" , "code_challenge" , "S256" , "redirect_uri"
8585 )
8686 uuid2 = await auth_db .insert_authorization_flow (
8787 "client_id2" , "scope2" , "code_challenge2" , "S256" , "redirect_uri2"
8888 )
89+ uuid3 = await auth_db .insert_authorization_flow (
90+ "client_id3" , "scope3" , "code_challenge3" , "S256" , "redirect_uri3"
91+ )
92+ uuid4 = await auth_db .insert_authorization_flow (
93+ "client_id4" , "scope4" , "code_challenge4" , "S256" , "redirect_uri4"
94+ )
8995
9096 id_token = {"sub" : "myIdToken" }
9197
9298 async with auth_db as auth_db :
93- code1 , _ = await auth_db .authorization_flow_insert_id_token (uuid1 , id_token , 1 )
94- code2 , _ = await auth_db .authorization_flow_insert_id_token (uuid2 , id_token , 1 )
99+ _ , _ = await auth_db .authorization_flow_insert_id_token (uuid2 , id_token , 1 )
100+ code3 , _ = await auth_db .authorization_flow_insert_id_token (uuid3 , id_token , 1 )
101+ code4 , _ = await auth_db .authorization_flow_insert_id_token (uuid4 , id_token , 1 )
95102
96103 async with auth_db as auth_db :
97- await auth_db .update_authorization_flow_status (code1 , FlowStatus .DONE )
98- await auth_db .update_authorization_flow_status (code2 , FlowStatus .ERROR )
104+ await auth_db .update_authorization_flow_status (code3 , FlowStatus .DONE )
105+ await auth_db .update_authorization_flow_status (code4 , FlowStatus .ERROR )
99106
100107 # Check the number of deleted authorization flow (should be 0)
101108 async with auth_db as auth_db :
102109 deleted_auth = await auth_db .clean_expired_authorization_flows (max_retention = 30 )
103110 assert deleted_auth == 0
104111
105- # Check the number of deleted authorization flow (should be 2 )
112+ # Check the number of deleted authorization flow (should be 4: 1 PENDING, 1 READY, 1 DONE, 1 ERROR )
106113 async with auth_db as auth_db :
107114 deleted_auth = await auth_db .clean_expired_authorization_flows (max_retention = 0 )
108- assert deleted_auth == 2
115+ assert deleted_auth == 4
109116
110117 # Check the number of deleted authorization flow (should be 0 because there is nothing left to delete)
111118 async with auth_db as auth_db :
0 commit comments