forked from zappa/Zappa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write tests confirming Binary Support response behavior
No functional change to the Zappa codebase is introduced by this commit. This area of the application was untested. Tests introduced to ensure new behavior discussed in zappa#908 does not cause a regression.
- Loading branch information
Showing
4 changed files
with
106 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
API_STAGE = 'dev' | ||
APP_FUNCTION = 'app' | ||
APP_MODULE = 'tests.test_wsgi_binary_support_app' | ||
BINARY_SUPPORT = True | ||
CONTEXT_HEADER_MAPPINGS = {} | ||
DEBUG = 'True' | ||
DJANGO_SETTINGS = None | ||
DOMAIN = 'api.example.com' | ||
ENVIRONMENT_VARIABLES = {} | ||
LOG_LEVEL = 'DEBUG' | ||
PROJECT_NAME = 'binary_support_settings' | ||
COGNITO_TRIGGER_MAPPING = {} |
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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
### | ||
# This test application exists to confirm how Zappa handles WSGI application | ||
# _responses_ when Binary Support is enabled. | ||
### | ||
|
||
import io | ||
import json | ||
from flask import Flask, Response, send_file | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/textplain_mimetype_response1', methods=['GET']) | ||
def text_mimetype_response_1(): | ||
return Response(response="OK", mimetype="text/plain") | ||
|
||
|
||
@app.route('/textarbitrary_mimetype_response1', methods=['GET']) | ||
def text_mimetype_response_2(): | ||
return Response(response="OK", mimetype="text/arbitary") | ||
|
||
|
||
@app.route('/json_mimetype_response1', methods=['GET']) | ||
def json_mimetype_response_1(): | ||
return Response(response=json.dumps({"some": "data"}), mimetype="application/json") | ||
|
||
|
||
@app.route('/arbitrarybinary_mimetype_response1', methods=['GET']) | ||
def arbitrary_mimetype_response_1(): | ||
return Response(response=b"some binary data", mimetype="arbitrary/binary_mimetype") |
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