17
17
18
18
@pytest .mark .anyio
19
19
@pytest .mark .parametrize ("save_exchange_record" , [None , False , True ])
20
- @pytest .mark .xdist_group (name = "issuer_test_group_3 " )
20
+ @pytest .mark .xdist_group (name = "issuer_test_group " )
21
21
async def test_issue_credential_with_save_exchange_record (
22
- faber_indy_client : RichAsyncClient ,
23
- indy_credential_definition_id : str ,
24
- faber_indy_and_alice_connection : FaberAliceConnect ,
22
+ faber_anoncreds_client : RichAsyncClient ,
23
+ anoncreds_credential_definition_id : str ,
24
+ faber_anoncreds_and_alice_connection : FaberAliceConnect ,
25
25
alice_member_client : RichAsyncClient ,
26
26
save_exchange_record : Optional [bool ],
27
27
) -> CredentialExchange :
28
28
credential = {
29
- "connection_id" : faber_indy_and_alice_connection .faber_connection_id ,
30
- "indy_credential_detail" : {
31
- "credential_definition_id" : indy_credential_definition_id ,
29
+ "type" : "anoncreds" ,
30
+ "connection_id" : faber_anoncreds_and_alice_connection .faber_connection_id ,
31
+ "anoncreds_credential_detail" : {
32
+ "credential_definition_id" : anoncreds_credential_definition_id ,
32
33
"attributes" : sample_credential_attributes ,
33
34
},
34
35
"save_exchange_record" : save_exchange_record ,
35
36
}
36
37
37
38
# create and send credential offer- issuer
38
39
faber_send_response = (
39
- await faber_indy_client .post (
40
+ await faber_anoncreds_client .post (
40
41
CREDENTIALS_BASE_PATH ,
41
42
json = credential ,
42
43
)
@@ -84,7 +85,7 @@ async def test_issue_credential_with_save_exchange_record(
84
85
if save_exchange_record :
85
86
# get exchange records from faber side:
86
87
faber_cred_ex_record = (
87
- await faber_indy_client .get (
88
+ await faber_anoncreds_client .get (
88
89
f"{ CREDENTIALS_BASE_PATH } /{ faber_credential_exchange_id } "
89
90
)
90
91
).json ()
@@ -97,42 +98,43 @@ async def test_issue_credential_with_save_exchange_record(
97
98
else :
98
99
# If save_exchange_record was not set, credential should not exist
99
100
with pytest .raises (HTTPException ) as exc :
100
- await faber_indy_client .get (
101
+ await faber_anoncreds_client .get (
101
102
f"{ CREDENTIALS_BASE_PATH } /{ faber_credential_exchange_id } "
102
103
)
103
104
assert exc .value .status_code == 404
104
105
105
106
finally :
106
107
# Clean up
107
108
if save_exchange_record :
108
- await faber_indy_client .delete (
109
+ await faber_anoncreds_client .delete (
109
110
f"{ CREDENTIALS_BASE_PATH } /{ faber_credential_exchange_id } "
110
111
)
111
112
112
113
113
114
@pytest .mark .anyio
114
115
@pytest .mark .parametrize ("save_exchange_record" , [None , False , True ])
115
- @pytest .mark .xdist_group (name = "issuer_test_group_4 " )
116
+ @pytest .mark .xdist_group (name = "issuer_test_group " )
116
117
async def test_request_credential_with_save_exchange_record (
117
- faber_indy_client : RichAsyncClient ,
118
- indy_credential_definition_id : str ,
119
- faber_indy_and_alice_connection : FaberAliceConnect ,
118
+ faber_anoncreds_client : RichAsyncClient ,
119
+ anoncreds_credential_definition_id : str ,
120
+ faber_anoncreds_and_alice_connection : FaberAliceConnect ,
120
121
alice_member_client : RichAsyncClient ,
121
122
save_exchange_record : bool ,
122
123
):
123
124
# This test asserts that the holder can control `save_exchange_records` behaviour
124
125
credential = {
125
- "connection_id" : faber_indy_and_alice_connection .faber_connection_id ,
126
- "indy_credential_detail" : {
127
- "credential_definition_id" : indy_credential_definition_id ,
126
+ "type" : "anoncreds" ,
127
+ "connection_id" : faber_anoncreds_and_alice_connection .faber_connection_id ,
128
+ "anoncreds_credential_detail" : {
129
+ "credential_definition_id" : anoncreds_credential_definition_id ,
128
130
"attributes" : {"speed" : "20" , "name" : "Alice" , "age" : "44" },
129
131
},
130
132
"save_exchange_record" : True , # so we can safely delete faber cred ex record in finally block
131
133
}
132
134
133
135
# Create and send credential offer - issuer
134
136
faber_send_response = (
135
- await faber_indy_client .post (
137
+ await faber_anoncreds_client .post (
136
138
CREDENTIALS_BASE_PATH ,
137
139
json = credential ,
138
140
)
@@ -201,17 +203,17 @@ async def test_request_credential_with_save_exchange_record(
201
203
await alice_member_client .delete (
202
204
f"{ CREDENTIALS_BASE_PATH } /{ alice_credential_exchange_id } "
203
205
)
204
- await faber_indy_client .delete (
206
+ await faber_anoncreds_client .delete (
205
207
f"{ CREDENTIALS_BASE_PATH } /{ faber_credential_exchange_id } "
206
208
)
207
209
208
210
209
211
@pytest .mark .anyio
210
- @pytest .mark .xdist_group (name = "issuer_test_group_3 " )
212
+ @pytest .mark .xdist_group (name = "issuer_test_group " )
211
213
async def test_get_cred_exchange_records (
212
- faber_indy_client : RichAsyncClient ,
213
- indy_credential_definition_id : str ,
214
- faber_indy_and_alice_connection : FaberAliceConnect ,
214
+ faber_anoncreds_client : RichAsyncClient ,
215
+ anoncreds_credential_definition_id : str ,
216
+ faber_anoncreds_and_alice_connection : FaberAliceConnect ,
215
217
alice_member_client : RichAsyncClient ,
216
218
):
217
219
# Fetch existing records so we can filter to exclude them. Necessary to cater for long running / regression tests
@@ -220,18 +222,19 @@ async def test_get_cred_exchange_records(
220
222
).json ()
221
223
222
224
credential = {
223
- "connection_id" : faber_indy_and_alice_connection .faber_connection_id ,
224
- "indy_credential_detail" : {
225
- "credential_definition_id" : indy_credential_definition_id ,
225
+ "type" : "anoncreds" ,
226
+ "connection_id" : faber_anoncreds_and_alice_connection .faber_connection_id ,
227
+ "anoncreds_credential_detail" : {
228
+ "credential_definition_id" : anoncreds_credential_definition_id ,
226
229
"attributes" : {"speed" : "20" , "name" : "Alice" , "age" : "44" },
227
230
},
228
231
"save_exchange_record" : True ,
229
232
}
230
233
231
- faber_send_response_1 = await faber_indy_client .post (
234
+ faber_send_response_1 = await faber_anoncreds_client .post (
232
235
CREDENTIALS_BASE_PATH , json = credential
233
236
)
234
- faber_send_response_2 = await faber_indy_client .post (
237
+ faber_send_response_2 = await faber_anoncreds_client .post (
235
238
CREDENTIALS_BASE_PATH , json = credential
236
239
)
237
240
@@ -283,10 +286,10 @@ async def test_get_cred_exchange_records(
283
286
)
284
287
285
288
await asyncio .sleep (1 ) # short sleep to allow records to update
286
- faber_records = (await faber_indy_client .get (CREDENTIALS_BASE_PATH )).json ()
289
+ faber_records = (await faber_anoncreds_client .get (CREDENTIALS_BASE_PATH )).json ()
287
290
288
291
faber_cred_ex_response = (
289
- await faber_indy_client .get (CREDENTIALS_BASE_PATH + "?state=done" )
292
+ await faber_anoncreds_client .get (CREDENTIALS_BASE_PATH + "?state=done" )
290
293
).json ()
291
294
filtered_cred_ex_records = [
292
295
record
@@ -296,7 +299,7 @@ async def test_get_cred_exchange_records(
296
299
assert len (filtered_cred_ex_records ) == 2
297
300
298
301
faber_cred_ex_response = (
299
- await faber_indy_client .get (CREDENTIALS_BASE_PATH + "?role=issuer" )
302
+ await faber_anoncreds_client .get (CREDENTIALS_BASE_PATH + "?role=issuer" )
300
303
).json ()
301
304
filtered_cred_ex_records = [
302
305
record
@@ -306,14 +309,14 @@ async def test_get_cred_exchange_records(
306
309
assert len (filtered_cred_ex_records ) == 2
307
310
308
311
faber_cred_ex_response = (
309
- await faber_indy_client .get (
312
+ await faber_anoncreds_client .get (
310
313
f"{ CREDENTIALS_BASE_PATH } ?thread_id={ faber_records [0 ]['thread_id' ]} "
311
314
)
312
315
).json ()
313
316
assert len (faber_cred_ex_response ) == 1
314
317
315
318
with pytest .raises (HTTPException ) as exc :
316
- await faber_indy_client .get (
319
+ await faber_anoncreds_client .get (
317
320
f"{ CREDENTIALS_BASE_PATH } ?connection_id=123&thread_id=123&role=asf&state=asd"
318
321
)
319
322
assert exc .value .status_code == 422
0 commit comments