Exemplo n.º 1
0
 def test_check_correct_password(self, tmpdir, caplog):
     caplog.set_level(logging.DEBUG)
     e = PyEncfs("--paranoia")
     assert e.create(tmpdir + "/e", tmpdir + "/d", "PASSWORD")
     assert e.umount(tmpdir + "/d")
     assert e.check_password(tmpdir + "/e", "PASSWORD")
     assert "Password is correct" in caplog.text
Exemplo n.º 2
0
 def test_check_wrong_password(self, tmpdir, caplog):
     caplog.set_level(logging.DEBUG)
     e = PyEncfs("--paranoia")
     assert e.create(tmpdir + "/e", tmpdir + "/d", "PASSWORD")
     assert e.umount(tmpdir + "/d")
     assert not e.check_password(tmpdir + "/e", "PASSWORD1")
     assert "Not the correct password" in caplog.text
Exemplo n.º 3
0
 def test_check_password_umount_subprocess_failure(self, tmpdir):
     e = PyEncfs("--paranoia")
     assert e.create(tmpdir + "/e", tmpdir + "/d", "PASSWORD")
     assert e.umount(tmpdir + "/d")
     with mock.patch("subprocess.run", side_effect=Exception("outch")):
         assert not e.check_password(tmpdir + "/e", "PASSWORD")