| 380 | |
| 381 | |
| 382 | def test_proxy_failure(mocker, empty_environ): |
| 383 | app = Dash() |
| 384 | |
| 385 | # if the tests work we'll never get to server.run, but keep the mock |
| 386 | # in case something is amiss and we don't get an exception. |
| 387 | mocker.patch.object(app.server, "run") |
| 388 | |
| 389 | with pytest.raises(_exc.ProxyError) as excinfo: |
| 390 | app.run( |
| 391 | proxy="https://127.0.0.1:8055::http://plot.ly", host="127.0.0.1", port=8055 |
| 392 | ) |
| 393 | assert "protocol: http is incompatible with the proxy" in excinfo.exconly() |
| 394 | assert "you must use protocol: https" in excinfo.exconly() |
| 395 | |
| 396 | with pytest.raises(_exc.ProxyError) as excinfo: |
| 397 | app.run( |
| 398 | proxy="http://0.0.0.0:8055::http://plot.ly", host="127.0.0.1", port=8055 |
| 399 | ) |
| 400 | assert "host: 127.0.0.1 is incompatible with the proxy" in excinfo.exconly() |
| 401 | assert "you must use host: 0.0.0.0" in excinfo.exconly() |
| 402 | |
| 403 | with pytest.raises(_exc.ProxyError) as excinfo: |
| 404 | app.run(proxy="http://0.0.0.0:8155::http://plot.ly", host="0.0.0.0", port=8055) |
| 405 | assert "port: 8055 is incompatible with the proxy" in excinfo.exconly() |
| 406 | assert "you must use port: 8155" in excinfo.exconly() |
| 407 | |
| 408 | |
| 409 | def test_title(): |