From d1dbfbd52e1311b04d965bdb7adecd50d2ad590b Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Wed, 29 Dec 2010 15:14:27 -0800
Subject: [PATCH] got the session testing working

---
 helios/tests.py    | 13 ++++++++++---
 settings.py.sample |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/helios/tests.py b/helios/tests.py
index aae0e46..eee4035 100644
--- a/helios/tests.py
+++ b/helios/tests.py
@@ -2,7 +2,7 @@
 Unit Tests for Helios
 """
 
-import unittest, datetime
+import unittest, datetime, re
 
 import models
 from auth import models as auth_models
@@ -258,9 +258,12 @@ class ElectionBlackboxTests(TestCase):
         self.assertRedirects(response, "/auth/?return_url=/helios/elections/new")
         
     def test_do_complete_election(self):
+        # a bogus call to set up the session
+        self.client.get("/")
+
         # set up the session
         session = self.client.session
-        session['user'] = self.user
+        session['user'] = {'type': self.user.user_type, 'user_id': self.user.user_id}
         session.save()
 
         # create the election
@@ -273,7 +276,11 @@ class ElectionBlackboxTests(TestCase):
                 "use_advanced_audit_features": "1",
                 "private_p" : "0"})
 
-        import pdb; pdb.set_trace()
+        # we are redirected to the election
+        election_id = re.search('/elections/([^/]+)/', str(response['Location'])).group(1)
+
+        assert False
+        
         # add helios as trustee
 
         # add a few voters
diff --git a/settings.py.sample b/settings.py.sample
index d9d81ca..ec1e5ac 100644
--- a/settings.py.sample
+++ b/settings.py.sample
@@ -74,7 +74,7 @@ TEMPLATE_DIRS = (
 
 INSTALLED_APPS = (
 #    'django.contrib.auth',
-    'django.contrib.contenttypes',
+#    'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
     ## needed for queues
-- 
GitLab