-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from aiven/hacka-fix-test_remote_client
tests: allow repeated execution of test_remote_client
- Loading branch information
Showing
1 changed file
with
4 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
from karapace.schema_reader import SchemaType, TypedSchema | ||
from karapace.serialization import SchemaRegistryClient | ||
from tests.utils import schema_avro_json | ||
from tests.utils import new_random_name, schema_avro_json | ||
|
||
|
||
async def test_remote_client(registry_async_client): | ||
schema_avro = TypedSchema.parse(SchemaType.AVRO, schema_avro_json) | ||
reg_cli = SchemaRegistryClient() | ||
reg_cli.client = registry_async_client | ||
sc_id = await reg_cli.post_new_schema("foo", schema_avro) | ||
subject = new_random_name("subject") | ||
sc_id = await reg_cli.post_new_schema(subject, schema_avro) | ||
assert sc_id >= 0 | ||
stored_schema = await reg_cli.get_schema_for_id(sc_id) | ||
assert stored_schema == schema_avro, f"stored schema {stored_schema.to_json()} is not {schema_avro.to_json()}" | ||
stored_id, stored_schema = await reg_cli.get_latest_schema("foo") | ||
stored_id, stored_schema = await reg_cli.get_latest_schema(subject) | ||
assert stored_id == sc_id | ||
assert stored_schema == schema_avro |