Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:46:40 +08:00
commit 66f1bf4fb0
33 changed files with 6059 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
#!/bin/bash
# Django-Allauth Installation Test Validator
# This script runs the official django-allauth test suite to verify installation
set -e # Exit on error
echo "======================================================================"
echo "Django-Allauth Installation Test Validator"
echo "======================================================================"
echo ""
# Color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Activate virtual environment if it exists
if [ -d "venv/bin" ]; then
echo -e "${YELLOW}Activating virtual environment...${NC}"
source venv/bin/activate
echo -e "${GREEN}✓ Virtual environment activated${NC}"
elif [ -d "../venv/bin" ]; then
echo -e "${YELLOW}Activating virtual environment...${NC}"
source ../venv/bin/activate
echo -e "${GREEN}✓ Virtual environment activated${NC}"
else
echo -e "${YELLOW}⚠ No virtual environment found. Using system Python.${NC}"
fi
# Check if we're in the django-allauth directory
if [ ! -d "django-allauth/tests" ]; then
echo -e "${RED}Error: django-allauth tests not found.${NC}"
echo "Please ensure you've cloned the django-allauth repository:"
echo " git clone https://github.com/pennersr/django-allauth.git"
exit 1
fi
# Check if pytest is installed
if ! command -v pytest &> /dev/null; then
echo -e "${YELLOW}Installing test dependencies...${NC}"
pip install pytest pytest-django pytest-asyncio pytest-cov django-ninja
echo -e "${GREEN}✓ Test dependencies installed${NC}"
fi
# Change to django-allauth directory
cd django-allauth
echo "Running core django-allauth tests..."
echo "This will verify your installation is working correctly."
echo ""
# Run the core test suite
pytest \
tests/apps/account/test_login.py \
tests/apps/account/test_signup.py \
tests/apps/account/test_logout.py \
tests/apps/account/test_email_verification.py \
tests/apps/account/test_reset_password.py \
tests/apps/account/test_change_password.py \
tests/apps/account/test_security.py \
tests/apps/account/test_middleware.py \
tests/apps/account/test_models.py \
-v \
-W ignore::pytest.PytestRemovedIn9Warning \
--tb=short
# Capture exit code
EXIT_CODE=$?
echo ""
echo "======================================================================"
if [ $EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}✓ All tests passed! Django-allauth is properly installed.${NC}"
else
echo -e "${YELLOW}⚠ Some tests failed, but this may be expected (e.g., async tests).${NC}"
echo "Check the output above for details."
fi
echo "======================================================================"
exit $EXIT_CODE