-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
1 changed file
with
29 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,34 @@ | ||
from django.test import TestCase | ||
|
||
from pinax.news.models import News | ||
from pinax.news.templatetags.pinax_news_tags import news, press_releases | ||
|
||
|
||
class Tests(TestCase): | ||
|
||
def setUp(self): | ||
pass | ||
def test_html_generated_on_save(self): | ||
news = News.objects.create( | ||
title="Test News", | ||
url="http://example.com", | ||
description="### The Main Event\n\n* Item Number 1\n* Item Number 2" | ||
) | ||
self.assertEquals(news.description_html, "<h3>The Main Event</h3>\n<ul>\n<li>Item Number 1</li>\n<li>Item Number 2</li>\n</ul>") | ||
|
||
def test_news_tag(self): | ||
News.objects.create( | ||
title="Test News", | ||
url="http://example.com", | ||
description="### The Main Event\n\n* Item Number 1\n* Item Number 2" | ||
) | ||
self.assertEquals(news().count(), 1) | ||
self.assertEquals(press_releases().count(), 0) | ||
|
||
def test_press_releases_tag(self): | ||
News.objects.create( | ||
title="Test News", | ||
url="http://example.com", | ||
description="### The Main Event\n\n* Item Number 1\n* Item Number 2", | ||
press_release=True | ||
) | ||
self.assertEquals(news().count(), 0) | ||
self.assertEquals(press_releases().count(), 1) |