Skip to content

Commit

Permalink
Test calling view func decorated with Blueprint.doc
Browse files Browse the repository at this point in the history
Restores full test coverage.
  • Loading branch information
lafrech committed May 4, 2019
1 parent a155cf4 commit 4cf5958
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,12 @@ def func():
def test_blueprint_doc_function(self, app):
api = Api(app)
blp = Blueprint('test', __name__, url_prefix='/test')
client = app.test_client()

@blp.route('/', methods=('PUT', 'PATCH', ))
@blp.doc(summary='Dummy func', description='Do dummy stuff')
def view_func():
pass
return jsonify({'Value': 'OK'})

api.register_blueprint(blp)
spec = api.spec.to_dict()
Expand All @@ -425,6 +426,10 @@ def view_func():
assert path[method]['summary'] == 'Dummy func'
assert path[method]['description'] == 'Do dummy stuff'

response = client.put('/test/')
assert response.status_code == 200
assert response.json == {'Value': 'OK'}

def test_blueprint_doc_method_view(self, app):
api = Api(app)
blp = Blueprint('test', __name__, url_prefix='/test')
Expand Down

0 comments on commit 4cf5958

Please sign in to comment.