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

Implement file path serving at the level of the MiG WSGI wrapper. #129

Closed
wants to merge 34 commits into from

Conversation

albu-diku
Copy link

No description provided.

A great deal of code that we wish to exercise under test requires a
configuration object. The wiring to generate test configuration values
is already in tree, but actually consuming it in tests was done in an
ad-hoc fashion. Meanwhile the separate notion of a FakeConfiguration
was added primarily to allow exercising code that needs a specific
subset of vars set with specific values.

This patch raises this use-case to the level of the common support
library. Use the way a logger was exposed as a blueprint and add a
configuration property to MigTestCase - this is a computed property
that lazily creates a (by default) FakeConfiguration object.

This object persists for the duration of the test. Provide a means for
easily overriding this to make it a fully populated Configuration
instance using the testconfig - this mechanism is _declarative_ such
that the details of configuration loading are transparent to callers.
Document this use via an extra test case in the support library tests.
The code as previously written would unconditionally encode parts as
though they contained text - this went unnoticed on PY2 because strings
and bytes are one and the same thing but blew up on PY3 where a string
is explicitly of type unicode while a binary file would be raw bytes.

Explicitly check the output_format and if instructed to serve a file do
so without touching the chunks of file content bytes being yielded.
@albu-diku albu-diku closed this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant