Browse files

make sure all unit tests run.

  • Loading branch information...
1 parent 9f3d2d3 commit 58526d47c1edf3ba75a4177823ccb698fb26b1c4 @visiblegovernment committed Nov 1, 2011
Showing with 20 additions and 4 deletions.
  1. +4 −2 mainapp/fixtures/test_email_rules.json
  2. +16 −2 mainapp/tests/account.py
View
6 mainapp/fixtures/test_email_rules.json
@@ -5,7 +5,8 @@
"fields": {
"name": "TestCityWithoutEmail",
"province": 1,
- "email": ""
+ "email": "",
+ "slug": "TestCityWithoutEmail"
}
},
{
@@ -14,7 +15,8 @@
"fields": {
"name": "TestCityWithEmail",
"province": 1,
- "email": "311email@city.com"
+ "email": "311email@city.com",
+ "slug": "TestCityWithEmail"
}
},
View
18 mainapp/tests/account.py
@@ -5,6 +5,7 @@
from django.db import connection
from django.contrib.auth.models import User
from django.core import mail
+from django.conf import settings
class TestAccountHome(TestCase):
@@ -194,6 +195,11 @@ def test_subscribe_form(self):
r = c.get( '/reports/4/subscribers' )
self.assertEquals( r.status_code, 200 )
self.assertContains(r,"user2@test.com")
+ c2 = Client()
+ r = c2.get( '/reports/4/subscribers' )
+ self.assertEquals( r.status_code, 200 )
+ self.assertNotContains(r,"user2@test.com")
+
def test_subscribe_submit(self):
c = Client()
@@ -243,6 +249,14 @@ def test_subscribe_submit(self):
class TestRegistration(TestCase):
fixtures = []
+ def setUp(self):
+ self.curr_auth = settings.AUTHENTICATION_BACKENDS
+ settings.AUTHENTICATION_BACKENDS += ('mainapp.tests.testsocial_auth.dummy_socialauth.DummyBackend',)
+
+ def tearDown(self):
+ """Restores settings to avoid breaking other tests."""
+ settings.AUTHENTICATION_BACKENDS = self.curr_auth
+
def test_socialuth_registration_w_noemail(self):
# starting conditions
self.assertEquals(User.objects.filter(first_name=FNAME).count(),0)
@@ -320,11 +334,11 @@ def test_edit(self):
response = c.get('/accounts/edit/',follow=True)
self.assertEquals(response.status_code, 200 )
self.assertEquals(response.templates[0].name, 'account/edit.html')
- self.assertContains(response,'Editing Profile For %s %s' % ( FNAME, LNAME ))
+ self.assertContains(response,'Editing User Profile For %s %s' % ( FNAME, LNAME ))
self.assertContains(response,PHONE)
# test submitting an updated phone #
- response = c.post( '/accounts/edit/', data={ 'phone': UPDATE_PHONE }, follow=True, **{ "wsgi.url_scheme" : "https" })
+ response = c.post( '/accounts/edit/', data={ 'phone': UPDATE_PHONE, 'first_name':FNAME, 'last_name':LNAME }, follow=True, **{ "wsgi.url_scheme" : "https" })
self.assertEquals(response.status_code, 200 )
self.assertEquals(response.templates[0].name, 'account/home.html')
self.assertEquals(UserProfile.objects.filter(user__first_name=FNAME,phone=UPDATE_PHONE).count(),1)

0 comments on commit 58526d4

Please sign in to comment.