#!/bin/sh

set -e

service postgresql start

runuser -u postgres -- createuser --createdb debusine-signing

cp -a pyproject.toml "$AUTOPKGTEST_TMP/"
cd "$AUTOPKGTEST_TMP"

cat << EOF >> /etc/debusine/signing/test.py

# Use paths from the package (e.g. logs into /var/log/debusine/signing)
from .pkg_paths import *  # noqa
EOF

runuser -u debusine-signing -- pytest --rootdir=/usr/lib/python3/dist-packages -c pyproject.toml --ds=debusine.signing.settings -v --pyargs debusine.signing
