Exemple #1
0
 def test_failed_subprocess_run(self, tmpdir, caplog):
     e = PyEncfs("--paranoia")
     assert e._createpath(tmpdir + "/e")
     assert e._createpath(tmpdir + "/d")
     with mock.patch("subprocess.run", mock.MagicMock(return_value=True)):
         assert not e.mount(tmpdir + "/e", tmpdir + "/d", "PASSWORD")
     assert "Failed to detect valid mount point at" in caplog.text
Exemple #2
0
 def test_encryption_directory_is_file(self, tmpdir, caplog):
     e = PyEncfs("--paranoia")
     assert e._createpath(tmpdir + "/d")
     open(str(tmpdir + "/e"), "w+")
     assert not e.mount(tmpdir + "/e", tmpdir + "/d", "PASSWORD")
     assert "Failed to mount encfs file system" in caplog.text
Exemple #3
0
 def test_encfs_mount_subprocess_failure(self, tmpdir):
     e = PyEncfs("--paranoia")
     assert e._createpath(tmpdir + "/e")
     assert e._createpath(tmpdir + "/d")
     with mock.patch("subprocess.run", side_effect=Exception("outch")):
         assert not e.mount(tmpdir + "/e", tmpdir + "/d", "PASSWORD")