Skip to content

Commit

Permalink
test: validate_schema_request_body
Browse files Browse the repository at this point in the history
  • Loading branch information
amstee committed Jul 26, 2024
1 parent 06c7491 commit b1cd1d6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/unit/test_schema_registry_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,30 @@
from unittest.mock import ANY, AsyncMock, Mock, patch, PropertyMock

import asyncio
import pytest


async def test_validate_schema_request_body():
controller = KarapaceSchemaRegistryController(config=set_config_defaults(DEFAULTS))

controller._validate_schema_request_body("application/json", {
"schema": "{}",
"schemaType": "JSON",
"references": [],
"metadata": {},
"ruleSet": {}
})

with pytest.raises(HTTPResponse) as exc_info:
controller._validate_schema_request_body("application/json", {
"schema": "{}",
"schemaType": "JSON",
"references": [],
"unexpected_field_name": {},
"ruleSet": {}
})
assert exc_info.type is HTTPResponse
assert str(exc_info.value) == "HTTPResponse 422"


async def test_forward_when_not_ready():
Expand Down

0 comments on commit b1cd1d6

Please sign in to comment.