Skip to content
Browse files

error in 'to ward' email rule. bad merge?

  • Loading branch information...
1 parent 16f877f commit e83528df75a8c6caa28d67f2df52bbf841ecd274 @visiblegovernment committed Aug 5, 2011
Showing with 12 additions and 1 deletion.
  1. +1 −1 mainapp/emailrules.py
  2. +11 −0 mainapp/tests/emailrules.py
View
2 mainapp/emailrules.py
@@ -26,7 +26,7 @@ def value_for_city(self,email_rule):
class ToWard(EmailRuleBehaviour):
def get_email(self, report, email_rule):
- return( report.ward.councillor.email )
+ return( report.ward.email )
def describe(self, email_rule ):
return("Send Reports to Email Address for Ward")
View
11 mainapp/tests/emailrules.py
@@ -40,6 +40,17 @@ def test(self):
self.failUnlessEqual( self.test_ward.get_emails(self.test_report), ([self.test_report.ward.councillor.email],[]) )
+class TestToWardAddress(EmailRuleTestBase):
+
+ def test(self):
+ email = 'ward_email@yahoo.ca'
+ rule = EmailRule( rule=EmailRule.TO_WARD, city = self.test_city )
+ rule.save()
+ self.test_ward.councillor = None
+ self.test_ward.email = email
+ self.test_ward.save()
+ self.failUnlessEqual( self.test_ward.get_emails(self.test_report), ([email],[]) )
+
class TestMatchingCategoryClass(EmailRuleTestBase):

0 comments on commit e83528d

Please sign in to comment.
Something went wrong with that request. Please try again.