cli checks for cryptography library

This commit is contained in:
David Lord 2020-02-09 16:01:23 -08:00
parent 982663d063
commit bcde664f9a
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
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"