def with_duplicatate_listing(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Wayne")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Wayne")[0], ward='2', number='2', mi_sos_id=48, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=48) website.fetch() expect(len(website.parse())) == 33
def with_county_proposal(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Sanilac")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Lexington Township")[0], number='1', mi_sos_id=3, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=3) website.fetch() expect(len(website.parse())) == 33
def with_library_proposal(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Kalamazoo")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Galesburg")[0], number='1', mi_sos_id=6, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=6) website.fetch() expect(len(website.parse())) == 26
def with_proposal_section(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Kent")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Wyoming City")[0], ward='1', number='6', mi_sos_id=6009, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=6009) website.fetch() expect(len(website.parse())) == 1
def with_city_proposal(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Oakland")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Farmington Hills")[0], number='23', mi_sos_id=30, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=30) website.fetch() expect(len(website.parse())) == 26
def with_single_proposal(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Macomb")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Sterling Heights")[0], number='26', mi_sos_id=2000, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=2000) website.fetch() expect(len(website.parse())) == 31
def with_township_proposals(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Berrien")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="St. Joseph Charter Township")[0], number='1', mi_sos_id=1523, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=1523) website.fetch() expect(len(website.parse())) == 32
def with_school_district_proposal(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Midland")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Edenville Township")[0], number='1', mi_sos_id=67, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=67) website.fetch() expect(len(website.parse())) == 29
def with_township_proposal(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Livingston")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Hamburg Township")[0], number='3', mi_sos_id=2, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=2) website.fetch() expect(len(website.parse())) == 27
def with_library_postion_without_district(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Benzie")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Benzonia Township")[0], ward='', number='1', mi_sos_id=6442, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=6442) website.fetch() expect(len(website.parse())) == 30
def with_multiple_positions_and_no_terms(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Jackson")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Springport Township")[0], ward='', number='1', mi_sos_id=6733, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=6733) website.fetch() expect(len(website.parse())) == 27
def with_authority_position(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Genesee")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Mount Morris Township")[0], ward='', number='6', mi_sos_id=219, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=219) website.fetch() expect(len(website.parse())) == 27
def with_continuation_header(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Wayne")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Brownstown Township")[0], ward='', number='12', mi_sos_id=182, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=182) website.fetch() expect(len(website.parse())) == 28
def with_local_school_position(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Kent")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Grand Rapids")[0], ward='1', number='23', mi_sos_id=1848, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=1848) website.fetch() expect(len(website.parse())) == 26
def with_city_position(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Washtenaw")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Ann Arbor")[0], ward='5', number='8', mi_sos_id=10, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=10) website.fetch() expect(len(website.parse())) == 31
def with_district_in_proposal_title(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Saginaw")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Saginaw")[0], ward='', number='2', mi_sos_id=78, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=78) website.fetch() expect(len(website.parse())) == 29
def with_recall_election(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Cheboygan")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Inverness Township")[0], ward='', number='1', mi_sos_id=19, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=19) website.fetch() expect(len(website.parse())) == 28
def with_community_college_proposal_no_district(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Oakland")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="Charter Township of Lyon")[0], ward='', number='7', mi_sos_id=169, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=169) website.fetch() expect(len(website.parse())) == 27
def with_library_proposal_no_district(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Wayne")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Grosse Pointe")[0], ward='', number='1', mi_sos_id=6348, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=6348) website.fetch() expect(len(website.parse())) == 30
def with_school_proposal(expect, constants): models.District.objects.get_or_create(category=constants.county, name="Clinton") models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Shiawassee")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Ovid")[0], ward='', number='1', mi_sos_id=112, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=112) website.fetch() expect(len(website.parse())) == 27
def with_county_proposal(expect, constants): models.Precinct.objects.get_or_create( county=models.District.objects.get_or_create( category=constants.county, name="Kent")[0], jurisdiction=models.District.objects.get_or_create( category=constants.jurisdiction, name="City of Grand Rapids")[0], ward='1', number='9', mi_sos_id=1828, ) website = models.BallotWebsite( mi_sos_election_id=constants.election.mi_sos_id, mi_sos_precinct_id=1828) website.fetch() expect(len(website.parse())) == 24 expect( models.Candidate.objects.get( name="Bill Schuette").party.name) == "Republican" expect( models.Candidate.objects.get( name="Gretchen Whitmer").party.name) == "Democratic" expect( models.Candidate.objects.get( name="Bill Gelineau").party.name) == "Libertarian" expect(models.Candidate.objects.get( name="John James").party.name) == "Republican" expect( models.Candidate.objects.get( name="Debbie Stabenow").party.name) == "Democratic" expect( models.Candidate.objects.get(name="George E. Huffman III"). party.name) == "U.S. Taxpayers"