Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message formatting variable expansion #851

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion karapace/schema_registry_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class SchemaErrorMessages(Enum):
"forward, full, backward_transitive, forward_transitive, and "
"full_transitive"
)
SUBJECT_LEVEL_COMPATIBILITY_NOT_CONFIGURED_FMT = "Subject '%s' does not have subject-level compatibility configured"
SUBJECT_LEVEL_COMPATIBILITY_NOT_CONFIGURED_FMT = (
"Subject '{subject}' does not have subject-level compatibility configured"
)
REFERENCES_SUPPORT_NOT_IMPLEMENTED = "Schema references are not supported for '{schema_type}' schema type"


Expand Down
8 changes: 2 additions & 6 deletions tests/integration/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2103,9 +2103,7 @@ async def test_config(registry_async_client: Client, trail: str) -> None:
res = await registry_async_client.get(f"config/{subject_1}{trail}")
assert res.status_code == 404
assert res.json()["error_code"] == 40408
assert res.json()["message"] == SchemaErrorMessages.SUBJECT_LEVEL_COMPATIBILITY_NOT_CONFIGURED_FMT.value.format(
subject=subject_1
)
assert res.json()["message"] == f"Subject '{subject_1}' does not have subject-level compatibility configured"

res = await registry_async_client.put(f"config/{subject_1}{trail}", json={"compatibility": "FULL"})
assert res.status_code == 200
Expand All @@ -2125,9 +2123,7 @@ async def test_config(registry_async_client: Client, trail: str) -> None:
res = await registry_async_client.get(f"config/{subject_1}{trail}")
assert res.status_code == 404
assert res.json()["error_code"] == 40408
assert res.json()["message"] == SchemaErrorMessages.SUBJECT_LEVEL_COMPATIBILITY_NOT_CONFIGURED_FMT.value.format(
subject=subject_1
)
assert res.json()["message"] == f"Subject '{subject_1}' does not have subject-level compatibility configured"

# It's possible to add a config to a subject that doesn't exist yet
subject_2 = subject_name_factory()
Expand Down
Loading