Download app/tests/test_models.py from rastof9/fb: direct link, hf CLI and curl.
- Browser
- Download file 765 Bytes
-
https://huggingface.co/spaces/rastof9/fb/resolve/main/app/tests/test_models.py
- Command line
-
hf download hf://spaces/rastof9/fb/app/tests/test_models.py
-
curl -L -o test_models.py https://huggingface.co/spaces/rastof9/fb/resolve/main/app/tests/test_models.py
765 Bytes
| import pytest | |
| from app.models import User, Ad, AdVersion | |
| from app import db | |
| def test_user(): | |
| user = User(email="test@example.com") | |
| user.set_password("password123") | |
| return user | |
| def test_ad(test_user): | |
| return Ad(content="Test ad content", user_id=test_user.id) | |
| def test_user_creation(test_user): | |
| assert test_user.email == "test@example.com" | |
| assert test_user.check_password("password123") | |
| def test_ad_creation(test_ad): | |
| assert test_ad.content == "Test ad content" | |
| assert test_ad.user_id is not None | |
| def test_ad_version_creation(test_ad): | |
| version = AdVersion(content="Updated ad content", ad_id=test_ad.id) | |
| assert version.content == "Updated ad content" | |
| assert version.ad_id == test_ad.id |