Merge pull request #1084 from normanjaeckel/EmptyPersonFix

Fix method for empty person, fixes #1077
This commit is contained in:
Oskar Hahn 2013-11-19 11:52:33 -08:00
commit d889be6db6
3 changed files with 15 additions and 7 deletions

2
fabfile.py vendored
View File

@ -25,7 +25,7 @@ def coverage_report_plain():
Runs all tests and prints the coverage report. Runs all tests and prints the coverage report.
""" """
test() test()
local('coverage report -m --fail-under=73') local('coverage report -m --fail-under=75')
def coverage(): def coverage():

View File

@ -44,10 +44,10 @@ def absolute_url(model, link=None):
Example: {{ motion|absolute_url:'delete' }} Example: {{ motion|absolute_url:'delete' }}
""" """
try:
if link is None: if link is None:
url = model.get_absolute_url() url = model.get_absolute_url()
else: else:
try:
url = model.get_absolute_url(link) url = model.get_absolute_url(link)
except ValueError: except ValueError:
url = '' url = ''

View File

@ -91,6 +91,14 @@ class TestMotionDetailView(MotionViewTestCase):
response = self.staff_client.get('/motion/1/') response = self.staff_client.get('/motion/1/')
self.assertContains(response, '100.00 %') self.assertContains(response, '100.00 %')
def test_deleted_supporter(self):
config['motion_min_supporters'] = 1
self.motion1.support(self.registered)
self.assertContains(self.admin_client.get('/motion/1/'), 'registered')
self.registered.delete()
self.assertNotContains(self.admin_client.get('/motion/1/'), 'registered')
self.assertContains(self.admin_client.get('/motion/1/'), 'empty')
class TestMotionDetailVersionView(MotionViewTestCase): class TestMotionDetailVersionView(MotionViewTestCase):
def test_get(self): def test_get(self):