From 247658fb08eaa9032942536a6d9966098cb2d766 Mon Sep 17 00:00:00 2001 From: Henning Jacobs Date: Sat, 5 Dec 2015 20:07:51 +0100 Subject: [PATCH] #104 add test for int path parameter --- tests/fakeapi/api.yaml | 4 ++++ tests/fakeapi/hello.py | 4 ++++ tests/test_app.py | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/tests/fakeapi/api.yaml b/tests/fakeapi/api.yaml index 4848e7c8e..759f46003 100644 --- a/tests/fakeapi/api.yaml +++ b/tests/fakeapi/api.yaml @@ -555,6 +555,10 @@ paths: get: summary: Test class instance method operationId: fakeapi.hello.DummyClass.test_classmethod + /test-int-path/{someint}: + get: + summary: Test type casting of path parameter + operationId: fakeapi.hello.test_get_someint definitions: new_stack: type: object diff --git a/tests/fakeapi/hello.py b/tests/fakeapi/hello.py index 1f797ba36..0d27208b3 100755 --- a/tests/fakeapi/hello.py +++ b/tests/fakeapi/hello.py @@ -183,3 +183,7 @@ def test_schema_array(test_array): def test_schema_int(test_int): return test_int + + +def test_get_someint(someint): + return str(type(someint)) diff --git a/tests/test_app.py b/tests/test_app.py index 2f501fa03..e9fec30c6 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -523,3 +523,9 @@ def test_resolve_classmethod(app): app_client = app.app.test_client() resp = app_client.get('/v1.0/resolver-test/classmethod') # type: flask.Response assert resp.data.decode() == '"DummyClass"' + + +def test_path_parameter_someint(app): + app_client = app.app.test_client() + resp = app_client.get('/v1.0/test-int-path/123') # type: flask.Response + assert resp.data.decode() == '""'