This repository contains a test suite for the authentication system of a FastAPI application. It includes user registration, login, referral-based signups, and logout functionality, tested using pytest
and FastAPI TestClient
.
- ✅ User Registration (New user, duplicate user, invalid referral code, self-referral, successful referral)
- ✅ User Login (Valid and invalid credentials)
- ✅ User Logout
- ✅ Database Setup & Cleanup (SQLite in-memory database)
git clone https://github.com/simran1002/refer-loop.git
cd refer-loop
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pytest test_auth.py -s
POST /auth/register
POST /auth/login
POST /auth/logout
POST /password/forgot-password
POST /password/reset-password
GET /referral/referral-link?user_id=1
GET /referral/referral-stats?user_id=1
Run tests with verbosity for detailed output:
pytest test_auth.py -v
Print API response errors inside tests:
print(response.json())