diff --git a/acapy_agent/anoncreds/routes.py b/acapy_agent/anoncreds/routes.py index debd8ba176..2f877c5cc6 100644 --- a/acapy_agent/anoncreds/routes.py +++ b/acapy_agent/anoncreds/routes.py @@ -192,11 +192,6 @@ async def schemas_post(request: web.BaseRequest): name = schema_data.get("name") version = schema_data.get("version") - if not issuer_id or not attr_names or not name or not version: - raise web.HTTPBadRequest( - reason="issuerId, attrNames, name, and version are required" - ) - try: issuer = AnonCredsIssuer(profile) result = await issuer.create_and_register_schema( diff --git a/acapy_agent/anoncreds/tests/test_routes.py b/acapy_agent/anoncreds/tests/test_routes.py index 607b81f4ae..c59af1a662 100644 --- a/acapy_agent/anoncreds/tests/test_routes.py +++ b/acapy_agent/anoncreds/tests/test_routes.py @@ -97,6 +97,13 @@ async def test_schemas_post(self, mock_create_and_register_schema): }, {}, {"schema": {}}, + { + "schema": { + "attrNames": ["score"], + "name": "Example Schema", + "version": "0.0.1", + } + }, ] ) result = await test_module.schemas_post(self.request) @@ -105,9 +112,12 @@ async def test_schemas_post(self, mock_create_and_register_schema): assert mock_create_and_register_schema.call_count == 1 with self.assertRaises(web.HTTPBadRequest): + # Empty body + await test_module.schemas_post(self.request) + # Empty schema + await test_module.schemas_post(self.request) + # Missing issuerId await test_module.schemas_post(self.request) - - await test_module.schemas_post(self.request) async def test_get_schema(self): self.request.match_info = {"schema_id": "schema_id"}