Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pytest instead of unittest #390

Merged
merged 9 commits into from
Jul 16, 2020
5 changes: 4 additions & 1 deletion tests/server/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ def inner(

if expected_detail is None:
expected_detail = "Error trying to process rule "
CasperWA marked this conversation as resolved.
Show resolved Hide resolved
assert error["detail"].startswith(expected_detail), error
assert error["detail"].startswith(expected_detail), (
"No expected_detail provided and the error did not start with a standard Lark "
"error message."
)
else:
assert expected_detail == error["detail"], error

Expand Down
14 changes: 7 additions & 7 deletions tests/server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def check_keys(keys: list, response_subset: typing.Iterable):
for key in keys:
assert (
key in response_subset
), f"{key} missing from response {response_subset}"
), f"{key!r} missing from response {response_subset}"
ml-evs marked this conversation as resolved.
Show resolved Hide resolved

def test_response_okay(self):
"""Make sure the response was successful"""
Expand All @@ -129,18 +129,18 @@ def test_meta_response(self):
set(ResponseMeta.schema()["properties"].keys()) - set(meta_required_keys)
)
implemented_optional_keys = [
# "schema",
"time_stamp",
"data_returned",
"provider",
"data_available",
"implementation",
# These keys are not implemented in the example server implementations
CasperWA marked this conversation as resolved.
Show resolved Hide resolved
# Add them in when they are.
# "schema",
# "last_id",
# "response_message",
# "warnings",
]
# meta_may_keys = [
# "last_id",
# "response_message",
# "warnings",
# ]

self.check_keys(meta_required_keys, self.json_response["meta"])
self.check_keys(implemented_optional_keys, meta_optional_keys)
Expand Down