conftest.py 452 B

1234567891011121314151617181920212223242526
  1. import pytest
  2. from ..models import Theme
  3. @pytest.fixture
  4. def default_theme(db):
  5. return Theme.objects.get(is_default=True)
  6. @pytest.fixture
  7. def theme(db):
  8. return Theme.objects.create(name="Custom theme")
  9. @pytest.fixture
  10. def other_theme(db):
  11. return Theme.objects.create(name="Other theme")
  12. @pytest.fixture
  13. def active_theme(theme):
  14. Theme.objects.update(is_active=False)
  15. theme.is_active = True
  16. theme.save()
  17. return theme