This repository has been archived on 2023-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
python-blog/articles/tests/conftest.py

37 lines
883 B
Python
Raw Normal View History

2020-08-18 07:23:59 +02:00
import pytest
from django.utils import timezone
2020-08-18 07:23:59 +02:00
from articles.models import Article, Page, User
2020-08-18 07:23:59 +02:00
@pytest.fixture()
@pytest.mark.django_db
def author():
return User.objects.create_user("gaugendre")
@pytest.fixture()
@pytest.mark.django_db
def published_article(author):
return Article.objects.create(
title="Some interesting title",
status=Article.PUBLISHED,
author=author,
published_at=timezone.now(),
slug="some-slug",
content="# some markdown\n\n[a link](https://example.com)",
)
@pytest.fixture()
@pytest.mark.django_db
def published_page(author):
return Page.objects.create(
title="Some interesting title",
status=Article.PUBLISHED,
author=author,
published_at=timezone.now(),
slug="some-slug",
content="# some markdown\n\n[a link](https://example.com)",
)