Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Update listing page tests following item method API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmurty committed Oct 17, 2016
1 parent 4e74119 commit 3e6b51c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions icekit/content_collections/tests.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from django.contrib.auth import get_user_model
from django.http.request import HttpRequest
from django_webtest import WebTest

from icekit.tests.models import Article, ArticleListing
from icekit.models import Layout

User = get_user_model()


class TestContentCollections(WebTest):
"""
Test Article publishing
Expand Down Expand Up @@ -55,15 +57,21 @@ def setUp(self):
)

def test_model(self):
req = HttpRequest()
self.article.publish()
self.article_2.publish()
# test the listing contains the published article
self.assertTrue(self.article.get_published() in self.listing.get_public_items())
self.assertTrue(
self.article.get_published() in self.listing.get_public_items(req))
# ...not the draft one
self.assertTrue(self.article not in self.listing.get_public_items())
self.assertTrue(
self.article not in self.listing.get_public_items(req))
# ...not an article that isn't associated with the listing
self.assertTrue(self.article_2 not in self.listing.get_public_items())
self.assertTrue(self.article_2.get_published() not in self.listing.get_public_items())
self.assertTrue(
self.article_2 not in self.listing.get_public_items(req))
self.assertTrue(
self.article_2.get_published()
not in self.listing.get_public_items(req))
self.article.unpublish()
self.article_2.unpublish()

Expand Down

0 comments on commit 3e6b51c

Please sign in to comment.