Added direct test cases with and w/o flask.Response

This commit is contained in:
Valentín Gutiérrez
2016-02-03 11:05:39 +01:00
committed by Rafael Caricio
parent 678fbf792e
commit b28cd87fe5
3 changed files with 38 additions and 0 deletions

View File

@@ -656,6 +656,22 @@ paths:
in: query
required: true
/test-redirect-endpoint:
get:
summary: Tests handlers returning flask.Response objects
operationId: fakeapi.hello.test_redirect_endpoint
responses:
302:
description: 302 Found
/test-redirect-response-endpoint:
get:
summary: Tests handlers returning flask.Response objects
operationId: fakeapi.hello.test_redirect_response_endpoint
responses:
302:
description: 302 Found
definitions:
new_stack:
type: object

View File

@@ -2,6 +2,7 @@
from connexion import problem, request
from connexion import NoContent
from flask import redirect
class DummyClass:
@@ -234,3 +235,12 @@ def test_bool_default_param(thruthiness):
def test_required_param(simple):
return simple
def test_redirect_endpoint():
headers = {'Location': 'http://www.google.com/'}
return '', 302, headers
def test_redirect_response_endpoint():
return redirect('http://www.google.com/')

View File

@@ -613,3 +613,15 @@ def test_required_param_miss_config(app):
resp = app_client.get('/v1.0/test-required-param')
assert resp.status_code == 400
def test_redirect_endpoint(app):
app_client = app.app.test_client()
resp = app_client.get('/v1.0/test-redirect-endpoint')
assert resp.status_code == 302
def test_redirect_response_endpoint(app):
app_client = app.app.test_client()
resp = app_client.get('/v1.0/test-redirect-response-endpoint')
assert resp.status_code == 302