mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Update cherrypy-18.6.1
This commit is contained in:
parent
b3ae6bd695
commit
ebffd124f6
57 changed files with 1269 additions and 1509 deletions
|
@ -1,6 +1,6 @@
|
|||
"""Test helpers from ``cherrypy.lib.httputil`` module."""
|
||||
import pytest
|
||||
from six.moves import http_client
|
||||
import http.client
|
||||
|
||||
from cherrypy.lib import httputil
|
||||
|
||||
|
@ -49,12 +49,12 @@ EXPECTED_444 = (444, 'Non-existent reason', '')
|
|||
(None, EXPECTED_200),
|
||||
(200, EXPECTED_200),
|
||||
('500', EXPECTED_500),
|
||||
(http_client.NOT_FOUND, EXPECTED_404),
|
||||
(http.client.NOT_FOUND, EXPECTED_404),
|
||||
('444 Non-existent reason', EXPECTED_444),
|
||||
]
|
||||
)
|
||||
def test_valid_status(status, expected_status):
|
||||
"""Check valid int, string and http_client-constants
|
||||
"""Check valid int, string and http.client-constants
|
||||
statuses processing."""
|
||||
assert httputil.valid_status(status) == expected_status
|
||||
|
||||
|
@ -62,19 +62,20 @@ def test_valid_status(status, expected_status):
|
|||
@pytest.mark.parametrize(
|
||||
'status_code,error_msg',
|
||||
[
|
||||
('hey', "Illegal response status from server ('hey' is non-numeric)."),
|
||||
(
|
||||
'hey',
|
||||
r"Illegal response status from server \('hey' is non-numeric\)."
|
||||
),
|
||||
(
|
||||
{'hey': 'hi'},
|
||||
'Illegal response status from server '
|
||||
"({'hey': 'hi'} is non-numeric).",
|
||||
r'Illegal response status from server '
|
||||
r"\(\{'hey': 'hi'\} is non-numeric\).",
|
||||
),
|
||||
(1, 'Illegal response status from server (1 is out of range).'),
|
||||
(600, 'Illegal response status from server (600 is out of range).'),
|
||||
(1, r'Illegal response status from server \(1 is out of range\).'),
|
||||
(600, r'Illegal response status from server \(600 is out of range\).'),
|
||||
]
|
||||
)
|
||||
def test_invalid_status(status_code, error_msg):
|
||||
"""Check that invalid status cause certain errors."""
|
||||
with pytest.raises(ValueError) as excinfo:
|
||||
with pytest.raises(ValueError, match=error_msg):
|
||||
httputil.valid_status(status_code)
|
||||
|
||||
assert error_msg in str(excinfo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue