Author: batiste.bieler
Date: Fri Jan 23 01:55:13 2009
New Revision: 299

Added:
    trunk/pages/fixtures/
    trunk/pages/fixtures/tests.json
Modified:
    trunk/pages/tests.py
    trunk/pages/views.py

Log:
Fix a recurrent bug. Add a regression test for this one.

Added: trunk/pages/fixtures/tests.json
==============================================================================
--- (empty file)
+++ trunk/pages/fixtures/tests.json     Fri Jan 23 01:55:13 2009
@@ -0,0 +1,20 @@
+[
+  {
+    "pk": 1,
+    "model": "auth.user",
+    "fields": {
+      "username": "batiste",
+      "first_name": "",
+      "last_name": "",
+      "is_active": true,
+      "is_superuser": true,
+      "is_staff": true,
+      "last_login": "2009-01-23 03:16:13",
+      "groups": [],
+      "user_permissions": [],
+      "password": "sha1$a30c7$77c8300adae2295829eea32ed7a928c3d43b53f8",
+      "email": "[email protected]",
+      "date_joined": "2009-01-23 03:01:15"
+    }
+  }
+]

Modified: trunk/pages/tests.py
==============================================================================
--- trunk/pages/tests.py        (original)
+++ trunk/pages/tests.py        Fri Jan 23 01:55:13 2009
@@ -1,10 +1,16 @@
  from django.test import TestCase
  from pages.models import *
+from django.test.client import Client

  class PagesTestCase(TestCase):
-    fixtures = ['tests']
+    fixtures = ['tests.json']

-    def test_01(self):
-        assert(1==1)
-        pass
+    def test_01_add_page(self):
+        """
+        Test that the add admin page could be displayed correctly
+        """
+        c = Client()
+        c.login(username= 'batiste', password='b')
+        response = c.get('/admin/pages/page/add/')
+        assert(response.status_code == 200)


Modified: trunk/pages/views.py
==============================================================================
--- trunk/pages/views.py        (original)
+++ trunk/pages/views.py        Fri Jan 23 01:55:13 2009
@@ -32,6 +32,10 @@
              current_page = pages[0]
          template_name = current_page.get_template()
      else:
-        raise Http404
+        # Don't raise Http404 here because
+        # pages.admin.utils.get_placeholders need
+        # to get the context correctly
+        current_page = None
+
      return template_name, locals()
  details = auto_render(details)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to