Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tobias Lorenz
committed
Feb 19, 2013
1 parent
58b7d2a
commit 1044ab1
Showing
7 changed files
with
123 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Tests for models of the ``cmsplugin_blog_categories``` application.""" | ||
from django.test import TestCase | ||
|
||
from cmsplugin_blog_categories.cms_plugins import CMSCategoryPlugin | ||
from cmsplugin_blog_categories.tests.factories import CategoryPluginFactory | ||
|
||
|
||
class CMSCategoryPluginTestCase(TestCase): | ||
"""Tests for the ``CMSCategoryPlugin`` cmsplugin.""" | ||
longMessage = True | ||
|
||
def setUp(self): | ||
self.plugin = CategoryPluginFactory() | ||
self.cmsplugin = CMSCategoryPlugin() | ||
|
||
def test_render(self): | ||
self.assertEqual( | ||
self.cmsplugin.render(context={}, instance=self.plugin, | ||
placeholder=None), | ||
{'category': self.plugin.category, 'category_entries': [], | ||
'placeholder': None}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Tests for tags of the ``cmsplugin_blog_categories``` application.""" | ||
from django.test import TestCase | ||
|
||
from cmsplugin_blog_categories.templatetags import ( | ||
cmsplugin_blog_categories_tags as tags, | ||
) | ||
from cmsplugin_blog_categories.tests.factories import ( | ||
CategoryFactory, | ||
EntryFactory, | ||
EntryCategoryFactory, | ||
) | ||
|
||
|
||
class GetCategoryTestCase(TestCase): | ||
"""Tests for the ``get_category`` tag.""" | ||
longMessage = True | ||
|
||
def setUp(self): | ||
self.entry = EntryFactory() | ||
self.category = EntryCategoryFactory() | ||
|
||
def test_tag(self): | ||
self.assertFalse(tags.get_category()) | ||
self.assertFalse(tags.get_category(self.entry)) | ||
self.assertEqual(tags.get_category(self.category.entry), | ||
self.category.category) | ||
|
||
|
||
class RenderCategoryLinksTestCase(TestCase): | ||
"""Tests for the ``render_category_links`` tag.""" | ||
longMessage = True | ||
|
||
def setUp(self): | ||
self.entry_category = EntryCategoryFactory() | ||
self.category = CategoryFactory() | ||
|
||
def test_tag(self): | ||
self.assertEqual(tags.render_category_links({}).get('categories')[0], | ||
self.entry_category.category) | ||
self.assertEqual( | ||
tags.render_category_links({}, True).get('categories').count(), 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters