Author: batiste.bieler
Date: Sun Mar 1 06:04:40 2009
New Revision: 372
Modified:
trunk/pages/managers.py
trunk/pages/tests.py
Log:
Fix issue 64, add a regression test for it.
Modified: trunk/pages/managers.py
==============================================================================
--- trunk/pages/managers.py (original)
+++ trunk/pages/managers.py Sun Mar 1 06:04:40 2009
@@ -121,7 +121,7 @@
Gets the latest content for a particular page and language. Falls
back
to another language if wanted.
"""
- content = reversed(self.filter(page=page,
type=cnttype).order_by(latest_by).values('language', 'body'))
+ content = self.filter(page=page,
type=cnttype).order_by(latest_by).values('language', 'body')
content_dict = dict([(c['language'], c['body']) for c in content])
if language in content_dict:
return content_dict[language]
Modified: trunk/pages/tests.py
==============================================================================
--- trunk/pages/tests.py (original)
+++ trunk/pages/tests.py Sun Mar 1 06:04:40 2009
@@ -107,10 +107,13 @@
response = c.get('/admin/pages/page/1/')
self.assertEqual(response.status_code, 200)
page_data['title'] = 'changed title'
+ page_data['body'] = 'changed body'
response = c.post('/admin/pages/page/1/', page_data)
self.assertRedirects(response, '/admin/pages/page/')
page = Page.objects.get(id=1)
- assert(page.title() == 'changed title')
+ self.assertEqual(page.title(), 'changed title')
+ body = Content.objects.get_content(page, 'en', 'body')
+ self.assertEqual(body, 'changed body')
def test_06_site_framework(self):
"""
@@ -165,10 +168,6 @@
# we should get everything
self.assertEqual(Page.objects.on_site().count(), 3)
-
- self.test_02_create_page()
- self.test_05_edit_page()
- self.test_04_details_view()
def test_07_languages(self):
"""
@@ -184,7 +183,6 @@
page_data["title"] = 'french title'
response = c.post('/admin/pages/page/1/', page_data)
self.assertRedirects(response, '/admin/pages/page/')
- page = Page.objects.get(id=1)
c = Client()
c.cookies["django_language"] = 'en'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---