Skip to content

Commit 148db7d

Browse files
authoredMar 19, 2025
🧪 e2e test for creating AnonCreds cred def (#1395)
* 🧪 e2e test for creating AnonCreds cred def * 🎨 * 🚧 Testing create revocation registry fix in openwallet-foundation/acapy#3601 * 🚧 Trigger rebuild * ⬆️ Use latest acapy image
1 parent b6d1483 commit 148db7d

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed
 

‎app/tests/e2e/test_definitions.py

+67
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,70 @@ async def test_create_credential_definition(
234234
# There should be two revocation registries, assert at least one exists
235235
# one being used to issue credentials against and once full with to the next one
236236
assert len(revocation_registries) >= 1
237+
238+
239+
@pytest.mark.anyio
240+
@pytest.mark.parametrize("support_revocation", [False, True])
241+
@pytest.mark.xdist_group(name="issuer_test_group")
242+
async def test_create_anoncreds_credential_definition(
243+
anoncreds_schema_definition: CredentialSchema,
244+
faber_anoncreds_acapy_client: AcaPyClient,
245+
faber_anoncreds_client: RichAsyncClient,
246+
support_revocation: bool,
247+
):
248+
schema_id = anoncreds_schema_definition.id
249+
tag = random_string(5)
250+
credential_definition = CreateCredentialDefinition(
251+
schema_id=schema_id,
252+
tag=tag,
253+
support_revocation=support_revocation,
254+
)
255+
256+
auth = acapy_auth_verified(
257+
acapy_auth_from_header(faber_anoncreds_client.headers["x-api-key"])
258+
)
259+
260+
result = (
261+
await definitions.create_credential_definition(
262+
credential_definition=credential_definition, auth=auth
263+
)
264+
).model_dump()
265+
266+
faber_public_did = await get_public_did(faber_anoncreds_acapy_client)
267+
schema = await faber_anoncreds_acapy_client.anoncreds_schemas.get_schema(
268+
schema_id=schema_id
269+
)
270+
271+
assert_that(result).has_id(
272+
f"{faber_public_did.did}:3:CL:{schema.schema_metadata['seqNo']}:{tag}"
273+
)
274+
assert_that(result).has_tag(tag)
275+
assert_that(result).has_schema_id(schema_id)
276+
277+
cred_def_id = result["id"]
278+
get_cred_def_result = (
279+
await definitions.get_credential_definition_by_id(cred_def_id, auth)
280+
).model_dump()
281+
282+
assert_that(get_cred_def_result).has_tag(tag)
283+
assert_that(get_cred_def_result).has_schema_id(schema_id)
284+
285+
if support_revocation:
286+
# Assert that revocation registry was created
287+
rev_reg_result = await faber_anoncreds_acapy_client.anoncreds_revocation.get_active_revocation_registry(
288+
cred_def_id
289+
)
290+
issuer_rev_reg_record = rev_reg_result.result
291+
assert issuer_rev_reg_record
292+
assert cred_def_id == issuer_rev_reg_record.cred_def_id
293+
assert issuer_rev_reg_record.issuer_did == faber_public_did.did
294+
295+
revocation_registries = (
296+
await faber_anoncreds_acapy_client.anoncreds_revocation.get_revocation_registries(
297+
cred_def_id=cred_def_id
298+
)
299+
).rev_reg_ids
300+
301+
# There should be two revocation registries, assert at least one exists
302+
# one being used to issue credentials against and once full with to the next one
303+
assert len(revocation_registries) >= 1

‎dockerfiles/agents/Dockerfile

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
ARG BBS_SUFFIX="-bbs"
2-
FROM ghcr.io/didx-xyz/acapy-agent${BBS_SUFFIX}:py3.12-1.2.1-20250314
2+
FROM ghcr.io/didx-xyz/acapy-agent${BBS_SUFFIX}:py3.12-1.2.1-20250319
33

44
USER root
55

6+
RUN echo "Installing plugins"
7+
68
# Install Google Protobuf and Plugins
79
ARG PROTOBUF_VERSION=5.29.3
810
RUN pip install --no-cache-dir protobuf==${PROTOBUF_VERSION} \
9-
acapy-wallet-groups-plugin==1.2.1.post20250314 \
10-
# git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@release-1.2.1-20250314 \
11-
git+https://github.com/didx-xyz/aries-acapy-plugins@1.2.1-20250314#subdirectory=nats_events
11+
acapy-wallet-groups-plugin==1.2.1.post20250319 \
12+
# git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@release-1.2.1-20250319 \
13+
git+https://github.com/didx-xyz/aries-acapy-plugins@1.2.1-20250319#subdirectory=nats_events
1214

1315
COPY scripts/startup.sh startup.sh
1416
RUN chmod +x ./startup.sh

0 commit comments

Comments
 (0)
Please sign in to comment.