schon/scripts/Unix/test.sh
Egor fureunoir Gorbunov 943aa02cd3 Features: 1) Add test cases for DRF and GraphQL views in core, blog, payments, and vibes_auth applications; 2) Implement reusable GraphQL testing utilities in test classes; 3) Introduce test configuration scripts for Windows and Unix environments.
Fixes: 1) Correct entrypoint scripts by removing redundant `python` reference in `uv run` commands; 2) Resolve incorrect imports and adjust class renaming in vibes_auth tests; 3) Address typing errors and minor omissions in existing code.

Extra: 1) Improve formatting in settings and middleware files; 2) Update messaging test class names for clarity; 3) Cleanup unused imports and extra whitespaces, ensuring cleaner codebase.
2025-11-13 16:42:04 +03:00

50 lines
1.2 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
source ./scripts/Unix/starter.sh
report=""
while [ "$#" -gt 0 ]; do
case "$1" in
--report|-r)
if [ "${2-}" = "" ]; then
echo "Error: --report/-r requires an argument: xml or html" >&2
exit 1
fi
report="$2"
shift 2
;;
--report=*)
report="${1#*=}"
shift
;;
-r=*)
report="${1#*=}"
shift
;;
*)
echo "Unknown argument: $1" >&2
echo "Usage: $0 [--report|-r xml|html]" >&2
exit 1
;;
esac
done
case "${report:-}" in
"")
docker compose exec app uv run coverage erase
docker compose exec app uv run coverage run --source='.' --omit='storefront/*,monitoring/*,Dockerfiles/*,*/__init__.py,*/tests/*,*/migrations/*,manage.py,evibes/*' manage.py test
docker compose exec app uv run coverage report -m
;;
xml)
docker compose exec app uv run coverage xml
;;
html)
docker compose exec app uv run coverage html
;;
*)
echo "Invalid report type: $report (expected xml or html)" >&2
exit 1
;;
esac