dnscms: add more tests
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from news.models import NewsPage
|
||||
from tests.conftest import NewsPageFactory
|
||||
|
||||
|
||||
def test_news_page_persists_via_factory(news_index):
|
||||
page = NewsPageFactory(parent=news_index, title="Big news", excerpt="Short summary")
|
||||
|
||||
reloaded = NewsPage.objects.get(pk=page.pk)
|
||||
assert reloaded.title == "Big news"
|
||||
assert reloaded.excerpt == "Short summary"
|
||||
|
||||
|
||||
def test_graphql_news_index_query(news_index, graphql_post):
|
||||
response, body = graphql_post(
|
||||
"""
|
||||
query {
|
||||
newsIndex {
|
||||
title
|
||||
}
|
||||
}
|
||||
"""
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "errors" not in body, body
|
||||
assert body["data"]["newsIndex"]["title"] == news_index.title
|
||||
Reference in New Issue
Block a user