Skip to content

Commit

Permalink
Merge pull request apiflask#348 from hjlarry/fix-test
Browse files Browse the repository at this point in the history
  • Loading branch information
greyli authored Sep 3, 2022
2 parents 106ba0e + 33b39e0 commit 72589c7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/test_base_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ def foo():
assert schema['$ref'] == schema_ref


# TODO pytest seems can't catch the ValueError happened in the output decorator
def test_base_response_data_key(app, client):
pytest.skip()

app.config['BASE_RESPONSE_SCHEMA'] = BaseResponse
app.config['BASE_RESPONSE_DATA_KEY '] = 'data'

Expand All @@ -130,8 +127,9 @@ def foo():
data = {'id': '123', 'name': 'test'}
return {'message': 'Success.', 'status_code': '200', 'info': data}

with pytest.raises(ValueError):
client.get('/')
with app.test_request_context('/'):
with pytest.raises(RuntimeError, match=r'The data key.*is not found in the returned dict.'):
foo()


def test_base_response_204(app, client):
Expand Down

0 comments on commit 72589c7

Please sign in to comment.