Skip to content

Commit

Permalink
add test_120_request_arguments__missing_argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Oct 4, 2023
1 parent ba4e739 commit 843c76f
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions tests/unit_server/test_arghandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,20 +320,24 @@ def test_111_request_arguments__no_default_with_typing() -> None:
# NOTE - `choices` use-cases are tested in `_qualify_argument` tests


# def test_21_get_argument_no_body__errors() -> None:
# """Test `request.arguments`/`RequestHandler.get_argument()` arguments.
def test_120_request_arguments__missing_argument() -> None:
"""Test `request.arguments` arguments error case."""

# No tests for body-parsing.
# """
# # Missing Required Argument
# with pytest.raises(tornado.web.HTTPError) as e:
# pjba.return_value = {}
# rhga.side_effect = tornado.web.MissingArgumentError("Reqd")
# rest_handler.get_argument("Reqd")
# error_msg = "HTTP 400: `Reqd`: (MissingArgumentError) required argument is missing"
# assert str(e.value) == error_msg
# set up ArgumentHandler
rest_handler = RestHandler(
application=Mock(),
request=httputil.HTTPServerRequest(uri="foo.aq/all"),
)
arghand = ArgumentHandler(rest_handler.request.arguments)
arghand.add_argument("reqd")

# Missing Required Argument
with pytest.raises(tornado.web.HTTPError) as e:
arghand.parse_args()
error_msg = "HTTP 400: `reqd`: (MissingArgumentError) required argument is missing"
assert str(e.value) == error_msg

# # NOTE - `typ` and `choices` are tested in `_qualify_argument` tests
# NOTE - `typ` and `choices` are tested in `_qualify_argument` tests


# def test_30_get_json_body_argument() -> None:
Expand Down

0 comments on commit 843c76f

Please sign in to comment.