mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Update cherrpy to 17.4.2
This commit is contained in:
parent
f28e741ad7
commit
4d6279a626
131 changed files with 15864 additions and 10389 deletions
38
lib/cherrypy/test/test_native.py
Normal file
38
lib/cherrypy/test/test_native.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
"""Test the native server."""
|
||||
|
||||
import pytest
|
||||
from requests_toolbelt import sessions
|
||||
|
||||
import cherrypy._cpnative_server
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
'sys.platform == "win32"',
|
||||
reason='tests fail on Windows',
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def cp_native_server(request):
|
||||
"""A native server."""
|
||||
class Root(object):
|
||||
@cherrypy.expose
|
||||
def index(self):
|
||||
return 'Hello World!'
|
||||
|
||||
cls = cherrypy._cpnative_server.CPHTTPServer
|
||||
cherrypy.server.httpserver = cls(cherrypy.server)
|
||||
|
||||
cherrypy.tree.mount(Root(), '/')
|
||||
cherrypy.engine.start()
|
||||
request.addfinalizer(cherrypy.engine.stop)
|
||||
url = 'http://localhost:{cherrypy.server.socket_port}'.format(**globals())
|
||||
return sessions.BaseUrlSession(url)
|
||||
|
||||
|
||||
def test_basic_request(cp_native_server):
|
||||
"""A request to a native server should succeed."""
|
||||
resp = cp_native_server.get('/')
|
||||
assert resp.ok
|
||||
assert resp.status_code == 200
|
||||
assert resp.text == 'Hello World!'
|
Loading…
Add table
Add a link
Reference in a new issue