Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using the MockRegistryApi
# In unit tests =====================================
from kafkit.registry.sansio import MockRegistryApi
# The Avro schema that you'll be testing with
schema = {}
# The MockRegistryApi works just like the RegistryApi, but doesn't
# do any network requests.
registryclient = MockRegistryApi()
# Insert the schema you know you're using into the client's
# cache. The `1` is just the unique ID that the Confluent Schema
# Registry server would have assigned to it.
registryclient.schemas.insert(schema, 1)
# In the application code =============================
# Now you can pass this registryclient into the code being
# tested and it will work without any network I/O.
# The serializer can now use this registry. When it does
serializer = await Serializer.register(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.