Commits

Mikhail Korobov  committed fe61283

Very basic test to ensure that admin index page can be loaded

  • Participants
  • Parent commits b9979cd

Comments (0)

Files changed (3)

File test_proj/fixtures/users.json

+[
+    {
+        "pk": 1,
+        "model": "auth.user",
+        "fields": {
+            "username": "user",
+            "first_name": "",
+            "last_name": "",
+            "is_active": 1,
+            "is_superuser": 1,
+            "is_staff": 1,
+            "groups": [],
+            "user_permissions": [],
+            "password": "sha1$9efbf$da0bd72857bce1d486bd263b36482fa2fc82336d",
+            "email": "example@example.com",
+            "date_joined": "2009-10-30 03:17:26"
+        }
+    }
+]

File test_proj/settings.py

     PROJECT_PATH + '/templates',
 )
 
+FIXTURE_DIRS = ['fixtures']
+
+
 INSTALLED_APPS = [
     'admin_tools.theming',
     'admin_tools.menu',

File test_proj/test_app/tests.py

 from django.test import TestCase
 
 class AdminBasicTest(TestCase):
+    fixtures = ['users.json']
     def test_admin_loads(self):
-        self.client.get('/admin/')
+        c = self.client
+        self.assertTrue(c.login(username='user', password='123'))
+        res = c.get('/admin/')
+        self.assertEqual(res.status_code, 200)