(monkeypatch)
| 600 | |
| 601 | |
| 602 | def test_run_cert_adhoc(monkeypatch): |
| 603 | monkeypatch.setitem(sys.modules, "cryptography", None) |
| 604 | |
| 605 | # cryptography not installed |
| 606 | with pytest.raises(click.BadParameter): |
| 607 | run_command.make_context("run", ["--cert", "adhoc"]) |
| 608 | |
| 609 | # cryptography installed |
| 610 | monkeypatch.setitem(sys.modules, "cryptography", types.ModuleType("cryptography")) |
| 611 | ctx = run_command.make_context("run", ["--cert", "adhoc"]) |
| 612 | assert ctx.params["cert"] == "adhoc" |
| 613 | |
| 614 | # no key with adhoc |
| 615 | with pytest.raises(click.BadParameter): |
| 616 | run_command.make_context("run", ["--cert", "adhoc", "--key", __file__]) |
| 617 | |
| 618 | |
| 619 | def test_run_cert_import(monkeypatch): |
nothing calls this directly
no test coverage detected