1
0
Fork 0
mirror of synced 2024-11-18 15:15:35 -05:00
yadm/test/pinentry-mock
Erik Flodin 30fa6f08a4
Update testbed docker image
* Update base image to Ubuntu 24.10. This uses a python version where j2cli no
  longer works when installed using pip so use the version from Ubuntu instead
  which has been patched to work.

* Update shellcheck, pylint, pytest, isort, flake8, black and yamllint to the
  latest versions. This closes #502.

* Use a longer expect timeout to fix tests failing when gpg is killed due to
  this timeout.

* Explicitly flush gpg-agent's cached passwords to fix failing tests with
  latest gnupg. Also clean up after tests to avoid having gpg-agents running
  after the test (e.g. when running tests directly without docker).
2024-11-11 22:30:41 +01:00

19 lines
504 B
Bash
Executable file

#!/bin/bash
# This program is a custom mock pinentry program
# It uses whatever password is found in the /tmp directory
# If the password is empty, replies CANCEL causing an error to similate invalid
# credentials
echo "OK Pleased to meet you"
while read -r line; do
if [[ $line =~ GETPIN ]]; then
password="$(cat "$GNUPGHOME/mock-password" 2>/dev/null)"
if [ -n "$password" ]; then
echo "D $password"
echo "OK";
else
echo "CANCEL";
fi
else
echo "OK";
fi
done