Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
amstee committed Jul 31, 2024
1 parent 9f7685b commit c85f4aa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
13 changes: 12 additions & 1 deletion tests/integration/schema_registry/test_jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
TYPES_STRING_SCHEMA,
)
from tests.utils import new_random_name
from typing import Any, Dict

import json
import pytest
Expand Down Expand Up @@ -234,8 +235,14 @@ async def not_schemas_are_backward_compatible(

@pytest.mark.parametrize("trail", ["", "/"])
@pytest.mark.parametrize("compatibility", [CompatibilityModes.FORWARD, CompatibilityModes.BACKWARD, CompatibilityModes.FULL])
@pytest.mark.parametrize("metadata", [None, {}])
@pytest.mark.parametrize("rule_set", [None, {}])
async def test_same_jsonschema_must_have_same_id(
registry_async_client: Client, compatibility: CompatibilityModes, trail: str
registry_async_client: Client,
compatibility: CompatibilityModes,
trail: str,
metadata: Dict[str, Any],
rule_set: Dict[str, Any],
) -> None:
for schema in ALL_SCHEMAS:
subject = new_random_name("subject")
Expand All @@ -248,6 +255,8 @@ async def test_same_jsonschema_must_have_same_id(
json={
"schema": json.dumps(schema.schema),
"schemaType": SchemaType.JSONSCHEMA.value,
"metadata": metadata,
"ruleSet": rule_set,
},
)
assert first_res.status_code == 200
Expand All @@ -259,6 +268,8 @@ async def test_same_jsonschema_must_have_same_id(
json={
"schema": json.dumps(schema.schema),
"schemaType": SchemaType.JSONSCHEMA.value,
"metadata": metadata,
"ruleSet": rule_set,
},
)
assert second_res.status_code == 200
Expand Down
15 changes: 12 additions & 3 deletions tests/integration/test_schema_protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from karapace.typing import JsonData
from tests.base_testcase import BaseTestCase
from tests.utils import create_subject_name_factory
from typing import List, Optional, Union
from typing import Any, Dict, List, Optional, Union

import logging
import pytest
Expand Down Expand Up @@ -963,11 +963,20 @@ class ReferenceTestCase(BaseTestCase):
],
ids=str,
)
async def test_references(testcase: ReferenceTestCase, registry_async_client: Client):
@pytest.mark.parametrize("metadata", [None, {}])
@pytest.mark.parametrize("rule_set", [None, {}])
async def test_references(
testcase: ReferenceTestCase, registry_async_client: Client, metadata: Dict[str, Any], rule_set: Dict[str, Any]
):
for testdata in testcase.schemas:
if isinstance(testdata, TestCaseSchema):
print(f"Adding new schema, subject: '{testdata.subject}'\n{testdata.schema_str}")
body = {"schemaType": testdata.schema_type, "schema": testdata.schema_str}
body = {
"schemaType": testdata.schema_type,
"schema": testdata.schema_str,
"metadata": metadata,
"ruleSet": rule_set,
}
if testdata.references:
body["references"] = testdata.references
res = await registry_async_client.post(f"subjects/{testdata.subject}/versions", json=body)
Expand Down

0 comments on commit c85f4aa

Please sign in to comment.