| 29 | |
| 30 | |
| 31 | def 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 | |
| 51 | def start_test_server(): |