From 7d84d901af7a75924e84f24f0e969634055b9bc2 Mon Sep 17 00:00:00 2001 From: jamshale Date: Thu, 5 Dec 2024 18:55:24 +0000 Subject: [PATCH] Add a unit test Signed-off-by: jamshale --- .../v2_0/tests/test_routes.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/acapy_agent/protocols/issue_credential/v2_0/tests/test_routes.py b/acapy_agent/protocols/issue_credential/v2_0/tests/test_routes.py index 9e3663d5ed..0c31b211e4 100644 --- a/acapy_agent/protocols/issue_credential/v2_0/tests/test_routes.py +++ b/acapy_agent/protocols/issue_credential/v2_0/tests/test_routes.py @@ -61,6 +61,31 @@ async def test_validate_cred_filter_schema(self): with self.assertRaises(test_module.ValidationError): schema.validate_fields({"veres-one": {"no": "support"}}) + async def test_validate_cred_filter_anoncreds_schema(self): + schema = test_module.V20CredFilterAnoncredsSchema() + schema.validate_fields({"anoncreds": {"issuer_id": TEST_DID}}) + schema.validate_fields( + {"anoncreds": {"issuer_id": TEST_DID, "schema_version": "1.0"}} + ) + schema.validate_fields( + { + "anoncreds": {"issuer_id": TEST_DID}, + "ld_proof": {"credential": {}, "options": {}}, + } + ) + schema.validate_fields( + { + "anoncreds": {}, + "ld_proof": {"credential": {}, "options": {}}, + } + ) + with self.assertRaises(test_module.ValidationError): + schema.validate_fields({}) + with self.assertRaises(test_module.ValidationError): + schema.validate_fields(["hopeless", "stop"]) + with self.assertRaises(test_module.ValidationError): + schema.validate_fields({"veres-one": {"no": "support"}}) + async def test_validate_create_schema(self): schema = test_module.V20IssueCredSchemaCore() schema.validate(