File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,16 @@ def test_county_results_access(self):
47
47
48
48
class TestRace (TestCase ):
49
49
50
+ def setUp (self ):
51
+ self .smith_result = {
52
+ 'date' : '2012-11-06' ,
53
+ 'candidate' : 'Smith, Joe' ,
54
+ 'party' : 'Dem' ,
55
+ 'office' : 'President' ,
56
+ 'county' : 'Fairfax' ,
57
+ 'votes' : 2000 ,
58
+ }
59
+
50
60
def test_clean_office_rep (self ):
51
61
race = Race ("2012-11-06" , "U.S. Rep - 1" )
52
62
self .assertEquals (race .office , "U.S. House of Representatives" )
@@ -56,3 +66,14 @@ def test_clean_office_other(self):
56
66
race = Race ("2012-11-06" , "President" )
57
67
self .assertEquals (race .office , "President" )
58
68
self .assertEquals (race .district , "" )
69
+
70
+ def test_total_votes_default (self ):
71
+ "Race total votes should default to zero"
72
+ race = Race ("2012-11-06" , "President" )
73
+ self .assertEquals (race .total_votes , 0 )
74
+
75
+ def test_total_votes_update (self ):
76
+ "Race.add_result should update total votes for each result"
77
+ race = Race ("2012-11-06" , "President" )
78
+ race .add_result (self .smith_result )
79
+ self .assertEquals (race .total_votes , 2000 )
You can’t perform that action at this time.
0 commit comments