mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-10 20:37:50 +00:00
Added direct test cases with and w/o flask.Response
This commit is contained in:
committed by
Rafael Caricio
parent
678fbf792e
commit
b28cd87fe5
@@ -656,6 +656,22 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
required: true
|
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:
|
definitions:
|
||||||
new_stack:
|
new_stack:
|
||||||
type: object
|
type: object
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from connexion import problem, request
|
from connexion import problem, request
|
||||||
from connexion import NoContent
|
from connexion import NoContent
|
||||||
|
from flask import redirect
|
||||||
|
|
||||||
|
|
||||||
class DummyClass:
|
class DummyClass:
|
||||||
@@ -234,3 +235,12 @@ def test_bool_default_param(thruthiness):
|
|||||||
|
|
||||||
def test_required_param(simple):
|
def test_required_param(simple):
|
||||||
return 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/')
|
||||||
|
|||||||
@@ -613,3 +613,15 @@ def test_required_param_miss_config(app):
|
|||||||
|
|
||||||
resp = app_client.get('/v1.0/test-required-param')
|
resp = app_client.get('/v1.0/test-required-param')
|
||||||
assert resp.status_code == 400
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user