Commits

Josh VanderLinden committed f5fcd6f

Adding a test for the ArticleAdminForm. Fixed the feed tests.

Comments (0)

Files changed (1)

articles/tests.py

 from django.test import TestCase
 from django.test.client import Client
 
+from forms import ArticleAdminForm
 from models import Article, ArticleStatus, Tag, MARKUP_HTML
 
 class ArticleUtilMixin(object):
             'title': 'A new article',
             'slug': 'new-article',
             'content': 'Some content',
+            'tags': 'this is a test',
             'status': ArticleStatus.objects.default().id,
             'markup': MARKUP_HTML,
             'publish_date_0': '2011-08-15',
     def test_latest_entries(self):
         """Makes sure the latest entries feed works"""
 
-        self.client.get(reverse('articles_feed', args=['latest']))
-        self.client.get(reverse('articles_feed_atom', args=['latest']))
+        res = self.client.get(reverse('articles_feed', args=['latest']))
+        self.assertEqual(res.status_code, 200)
+
+        res = self.client.get(reverse('articles_feed_atom', args=['latest']))
+        self.assertEqual(res.status_code, 200)
 
     def test_tags(self):
         """Makes sure that the tags feed works"""
 
-        self.client.get(reverse('articles_feed', args=['tags/demo']))
-        self.client.get(reverse('articles_feed', args=['tags/demo/']))
+        res = self.client.get(reverse('articles_feed', args=['tags/demo']))
+        self.assertEqual(res.status_code, 200)
 
-        self.client.get(reverse('articles_feed_atom', args=['tags/demo']))
-        self.client.get(reverse('articles_feed_atom', args=['tags/demo/']))
+        res = self.client.get(reverse('articles_feed', args=['tags/demo/']))
+        self.assertEqual(res.status_code, 404)
+
+        res = self.client.get(reverse('articles_feed_atom', args=['tags/demo']))
+        self.assertEqual(res.status_code, 200)
+
+        res = self.client.get(reverse('articles_feed_atom', args=['tags/demo/']))
+        self.assertEqual(res.status_code, 404)
+
+class FormTest(TestCase, ArticleUtilMixin):
+    fixtures = ['users',]
+
+    def setUp(self):
+        self.client = Client()
+
+        User.objects.create_superuser('admin', 'admin@admin.com', 'admin')
+        self.client.login(username='admin', password='admin')
+
+    def tearDown(self):
+        pass
+
+    def test_article_admin_form(self):
+        """Makes sure the ArticleAdminForm works as expected"""
+
+        a = self.new_article('Sample', 'sample')
+        res = self.client.get(reverse('admin:articles_article_change', args=[a.id]))
+        self.assertEqual(res.status_code, 200)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.