aircox-radiocampus/aircox/tests/views/conftest.py
Chris Tactic 55123c386d #132 | #121: backoffice / dev-1.0-121 (#131)
cfr #121

Co-authored-by: Christophe Siraut <d@tobald.eu.org>
Co-authored-by: bkfox <thomas bkfox net>
Co-authored-by: Thomas Kairos <thomas@bkfox.net>
Reviewed-on: rc/aircox#131
Co-authored-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
Co-committed-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
2024-04-28 22:02:09 +02:00

40 lines
778 B
Python

import pytest
from model_bakery import baker
from aircox import models
class FakeView:
context = None
kwargs = {}
def ___init__(self):
self.kwargs = {}
def dispatch(self, *args, **kwargs):
pass
def get(self, *args, **kwargs):
pass
def get_queryset(self):
return self.queryset
def get_context_data(self, **kwargs):
return kwargs
@pytest.fixture
def published_pages():
return baker.make(models.Page, status=models.StaticPage.STATUS_PUBLISHED, _quantity=3)
@pytest.fixture
def unpublished_pages():
return baker.make(models.Page, status=models.StaticPage.STATUS_DRAFT, _quantity=3)
@pytest.fixture
def pages(published_pages, unpublished_pages):
return published_pages + unpublished_pages