def test_change_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.change_password(tmpdir + "/e", "PASSWORD", "PASSWD") assert "Password successfully changed" in caplog.text
def test_change_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.change_password(tmpdir + "/e", "PASSWORD1", "PASSWD") assert "Failed to change password" in caplog.text
def test_change_password_umount_subprocess_failure(self, tmpdir): e = PyEncfs("--paranoia") assert e.create(tmpdir + "/e", tmpdir + "/d", "PASSWORD") with mock.patch("subprocess.run", side_effect=Exception("outch")): assert not e.change_password(tmpdir + "/e", "PASSWORD", "PASSWD") assert e.umount(tmpdir + "/d")