-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
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
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.