MCPcopy
hub / github.com/pallets/flask / test_run_cert_import

Function test_run_cert_import

tests/test_cli.py:619–638  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

617
618
619def test_run_cert_import(monkeypatch):
620 monkeypatch.setitem(sys.modules, "not_here", None)
621
622 # ImportError
623 with pytest.raises(click.BadParameter):
624 run_command.make_context("run", ["--cert", "not_here"])
625
626 with pytest.raises(click.BadParameter):
627 run_command.make_context("run", ["--cert", "flask"])
628
629 # SSLContext
630 ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
631
632 monkeypatch.setitem(sys.modules, "ssl_context", ssl_context)
633 ctx = run_command.make_context("run", ["--cert", "ssl_context"])
634 assert ctx.params["cert"] is ssl_context
635
636 # no --key with SSLContext
637 with pytest.raises(click.BadParameter):
638 run_command.make_context("run", ["--cert", "ssl_context", "--key", __file__])
639
640
641def test_run_cert_no_ssl(monkeypatch):

Callers

nothing calls this directly

Calls 1

make_contextMethod · 0.80

Tested by

no test coverage detected