cli checks for cryptography library

This commit is contained in:
David Lord 2020-02-09 16:01:23 -08:00
parent a356c215df
commit d1ffe44185
3 changed files with 11 additions and 7 deletions

View file

@ -566,14 +566,14 @@ def test_run_cert_path():
def test_run_cert_adhoc(monkeypatch):
monkeypatch.setitem(sys.modules, "OpenSSL", None)
monkeypatch.setitem(sys.modules, "cryptography", None)
# pyOpenSSL not installed
# cryptography not installed
with pytest.raises(click.BadParameter):
run_command.make_context("run", ["--cert", "adhoc"])
# pyOpenSSL installed
monkeypatch.setitem(sys.modules, "OpenSSL", types.ModuleType("OpenSSL"))
# cryptography installed
monkeypatch.setitem(sys.modules, "cryptography", types.ModuleType("cryptography"))
ctx = run_command.make_context("run", ["--cert", "adhoc"])
assert ctx.params["cert"] == "adhoc"