Skip to content

Commit

Permalink
test: Test debug setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 22, 2024
1 parent 99adf4f commit 63f1cb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ venv
/docs/_build

# Tests
/.coverage
/.coverage*
/htmlcov
/_trial_temp
/tests.test_*
Expand Down
13 changes: 13 additions & 0 deletions tests/test_webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ def test_invalid_type(txrequest, root):
assert_error(txrequest, root, "POST", "schedule", args, message)


def test_debug(txrequest, root):
root.debug = True

txrequest.method = "POST"
txrequest.args = {b"project": [b"p"], b"spider": [b"s"], b"priority": [b"x"]}
response = root.children[b"schedule.json"].render(txrequest).decode()

assert response.startswith("Traceback (most recent call last):")
assert response.endswith(
f"twisted.web.error.Error: 200 priority is invalid: could not convert string to float: b'x'{os.linesep}"
)


def test_daemonstatus(txrequest, root_with_egg, scrapy_process):
expected = {"running": 0, "pending": 0, "finished": 0}
assert_content(txrequest, root_with_egg, "GET", "daemonstatus", {}, expected)
Expand Down

0 comments on commit 63f1cb5

Please sign in to comment.