MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / test

Function test

test/12.cors.py:31–48  ·  view source on GitHub ↗
(server_proc: subprocess.Popen, browser: Chrome)

Source from the content-addressed store, hash-verified

29
30
31def test(server_proc: subprocess.Popen, browser: Chrome):
32 raw_html = test_once(browser, '12.tornado_cors.html',
33 process_func=lambda i: i.replace('http://localhost:5000', 'http://localhost:8080'))
34 assert 'http://localhost:5000' in raw_html # origin
35
36 time.sleep(4)
37 browser.get('http://localhost:5000/?pywebio_api=http://localhost:8081/')
38 raw_html = test_once(browser, '12.aiohttp_cors.html',
39 process_func=lambda i: i.replace('http://localhost:5000', 'http://localhost:8080').replace(
40 'localhost:8081', 'localhost:8080'))
41 assert 'http://localhost:5000' in raw_html and 'localhost:8081' in raw_html # origin
42
43 time.sleep(4)
44 browser.get('http://localhost:5001/?pywebio_api=http://localhost:8082/')
45 raw_html = test_once(browser, '12.flask_cors.html',
46 process_func=lambda i: i.replace('http://localhost:5001', 'http://localhost:8080').replace(
47 'localhost:8082', 'localhost:8080'))
48 assert 'http://localhost:5001' in raw_html and 'localhost:8082' in raw_html # origin
49
50
51def start_test_server():

Callers

nothing calls this directly

Calls 2

test_onceFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…