def setUp(self): wmc_area_type = AreaTypeFactory.create() self.election = ElectionFactory.create( slug='2015', name='2015 General Election', area_types=(wmc_area_type,) ) commons = ParliamentaryChamberFactory.create() self.post_extra = PostExtraFactory.create( elections=(self.election,), base__organization=commons, slug='65808', base__label='Member of Parliament for Dulwich and West Norwood' ) PartyExtraFactory.reset_sequence() PartyFactory.reset_sequence() self.parties = {} for i in xrange(0, 4): party_extra = PartyExtraFactory.create() self.parties[party_extra.slug] = party_extra person_extra = PersonExtraFactory.create( base__id='2009', base__name='Tessa Jowell' ) CandidacyExtraFactory.create( election=self.election, base__person=person_extra.base, base__post=self.post_extra.base, base__on_behalf_of=self.parties['party:63'].base ) person_extra = PersonExtraFactory.create( base__id='2010', base__name='Andrew Smith', base__email='*****@*****.**', ) CandidacyExtraFactory.create( election=self.election, base__person=person_extra.base, base__post=self.post_extra.base, base__on_behalf_of=self.parties['party:63'].base )
def setUp(self): wmc_area_type = AreaTypeFactory.create() self.election = ElectionFactory.create(slug='2015', name='2015 General Election', area_types=(wmc_area_type, )) commons = ParliamentaryChamberFactory.create() self.post_extra = PostExtraFactory.create( elections=(self.election, ), base__organization=commons, slug='65808', base__label='Member of Parliament for Dulwich and West Norwood') PartyExtraFactory.reset_sequence() PartyFactory.reset_sequence() self.parties = {} for i in range(0, 4): party_extra = PartyExtraFactory.create() self.parties[party_extra.slug] = party_extra person_extra = PersonExtraFactory.create(base__id='2009', base__name='Tessa Jowell') CandidacyExtraFactory.create( election=self.election, base__person=person_extra.base, base__post=self.post_extra.base, base__on_behalf_of=self.parties['party:63'].base) person_extra = PersonExtraFactory.create( base__id='2010', base__name='Andrew Smith', base__email='*****@*****.**', ) CandidacyExtraFactory.create( election=self.election, base__person=person_extra.base, base__post=self.post_extra.base, base__on_behalf_of=self.parties['party:63'].base)
def setUp(self): wmc_area_type = AreaTypeFactory.create() gb_parties = PartySetFactory.create(slug='gb', name='Great Britain') election = ElectionFactory.create(slug='2015', name='2015 General Election', area_types=(wmc_area_type, )) area_extra = AreaExtraFactory.create( base__name="Dulwich and West Norwood", type=wmc_area_type, ) commons = ParliamentaryChamberFactory.create() post_extra = PostExtraFactory.create( elections=(election, ), base__area=area_extra.base, base__organization=commons, slug='65808', party_set=gb_parties, base__label='Member of Parliament for Dulwich and West Norwood') camberwell_area_extra = AreaExtraFactory.create( base__identifier='65913', type=wmc_area_type, ) camberwell_post = PostExtraFactory.create( elections=(election, ), base__area=camberwell_area_extra.base, base__organization=commons, slug='65913', candidates_locked=True, base__label='Member of Parliament for Camberwell and Peckham', party_set=gb_parties, ) person_extra = PersonExtraFactory.create(base__id='2009', base__name='Tessa Jowell') self.person = person_extra.base PartyExtraFactory.reset_sequence() PartyFactory.reset_sequence() self.parties = {} for i in range(0, 4): party_extra = PartyExtraFactory.create() gb_parties.parties.add(party_extra.base) self.parties[party_extra.slug] = party_extra CandidacyExtraFactory.create( election=election, base__person=person_extra.base, base__post=post_extra.base, base__on_behalf_of=self.parties['party:63'].base) person_extra = PersonExtraFactory.create(base__id='2010', base__name='Angela Smith') self.person2 = person_extra.base CandidacyExtraFactory.create( election=election, base__person=person_extra.base, base__post=post_extra.base, base__on_behalf_of=self.parties['party:63'].base) content_type = ContentType.objects.get_for_model(person_extra.base) last_sent = datetime.now(pytz.utc) - timedelta(days=2) self.alert = Alert.objects.create(user=self.user, target_content_type=content_type, target_object_id=self.person.id, last_sent=last_sent, frequency='hourly') self.alert2 = Alert.objects.create(user=self.user_who_can_lock, target_content_type=content_type, target_object_id=self.person2.id, last_sent=last_sent, frequency='daily') person_extra = PersonExtraFactory.create(base__id='2011', base__name='Martin Jones') self.person2 = person_extra.base CandidacyExtraFactory.create( election=election, base__person=person_extra.base, base__post=camberwell_post.base, base__on_behalf_of=self.parties['party:63'].base) content_type = ContentType.objects.get_for_model( camberwell_area_extra.base) self.alert3 = Alert.objects.create( user=self.user_who_can_merge, target_content_type=content_type, target_object_id=camberwell_area_extra.base.id, last_sent=last_sent, frequency='daily') aldershot_area_extra = AreaExtraFactory.create( base__identifier='65730', type=wmc_area_type, ) aldershot_post = PostExtraFactory.create( elections=(election, ), base__area=aldershot_area_extra.base, base__organization=commons, slug='65730', base__label='Member of Parliament for Aldershot', party_set=gb_parties, ) person_extra = PersonExtraFactory.create(base__id='2012', base__name='Gillian Collins') self.person3 = person_extra.base CandidacyExtraFactory.create( election=election, base__person=person_extra.base, base__post=aldershot_post.base, base__on_behalf_of=self.parties['party:63'].base) content_type = ContentType.objects.get_for_model( self.parties['party:90'].base) self.alert4 = Alert.objects.create( user=self.user_who_can_rename, target_content_type=content_type, target_object_id=self.parties['party:90'].base.id, last_sent=last_sent, frequency='daily') content_type = ContentType.objects.get_for_model( camberwell_area_extra.base) self.alert5 = Alert.objects.create(user=self.user, target_content_type=content_type, target_object_id=66101, last_sent=last_sent, frequency='hourly')
def setUp(self): wmc_area_type = AreaTypeFactory.create() gb_parties = PartySetFactory.create(slug='gb', name='Great Britain') election = ElectionFactory.create( slug='2015', name='2015 General Election', area_types=(wmc_area_type,) ) area_extra = AreaExtraFactory.create( base__name="Dulwich and West Norwood", type=wmc_area_type, ) commons = ParliamentaryChamberFactory.create() post_extra = PostExtraFactory.create( elections=(election,), base__area=area_extra.base, base__organization=commons, slug='65808', party_set=gb_parties, base__label='Member of Parliament for Dulwich and West Norwood' ) camberwell_area_extra = AreaExtraFactory.create( base__identifier='65913', type=wmc_area_type, ) camberwell_post = PostExtraFactory.create( elections=(election,), base__area=camberwell_area_extra.base, base__organization=commons, slug='65913', candidates_locked=True, base__label='Member of Parliament for Camberwell and Peckham', party_set=gb_parties, ) person_extra = PersonExtraFactory.create( base__id='2009', base__name='Tessa Jowell' ) self.person = person_extra.base PartyExtraFactory.reset_sequence() PartyFactory.reset_sequence() self.parties = {} for i in range(0, 4): party_extra = PartyExtraFactory.create() gb_parties.parties.add(party_extra.base) self.parties[party_extra.slug] = party_extra CandidacyExtraFactory.create( election=election, base__person=person_extra.base, base__post=post_extra.base, base__on_behalf_of=self.parties['party:63'].base ) person_extra = PersonExtraFactory.create( base__id='2010', base__name='Angela Smith' ) self.person2 = person_extra.base CandidacyExtraFactory.create( election=election, base__person=person_extra.base, base__post=post_extra.base, base__on_behalf_of=self.parties['party:63'].base ) content_type = ContentType.objects.get_for_model(person_extra.base) last_sent = datetime.now(pytz.utc) - timedelta(days=2) self.alert = Alert.objects.create( user=self.user, target_content_type=content_type, target_object_id=self.person.id, last_sent=last_sent, frequency='hourly' ) self.alert2 = Alert.objects.create( user=self.user_who_can_lock, target_content_type=content_type, target_object_id=self.person2.id, last_sent=last_sent, frequency='daily' ) person_extra = PersonExtraFactory.create( base__id='2011', base__name='Martin Jones' ) self.person2 = person_extra.base CandidacyExtraFactory.create( election=election, base__person=person_extra.base, base__post=camberwell_post.base, base__on_behalf_of=self.parties['party:63'].base ) content_type = ContentType.objects.get_for_model( camberwell_area_extra.base ) self.alert3 = Alert.objects.create( user=self.user_who_can_merge, target_content_type=content_type, target_object_id=camberwell_area_extra.base.id, last_sent=last_sent, frequency='daily' ) aldershot_area_extra = AreaExtraFactory.create( base__identifier='65730', type=wmc_area_type, ) aldershot_post = PostExtraFactory.create( elections=(election,), base__area=aldershot_area_extra.base, base__organization=commons, slug='65730', base__label='Member of Parliament for Aldershot', party_set=gb_parties, ) person_extra = PersonExtraFactory.create( base__id='2012', base__name='Gillian Collins' ) self.person3 = person_extra.base CandidacyExtraFactory.create( election=election, base__person=person_extra.base, base__post=aldershot_post.base, base__on_behalf_of=self.parties['party:63'].base ) content_type = ContentType.objects.get_for_model( self.parties['party:90'].base ) self.alert4 = Alert.objects.create( user=self.user_who_can_rename, target_content_type=content_type, target_object_id=self.parties['party:90'].base.id, last_sent=last_sent, frequency='daily' ) content_type = ContentType.objects.get_for_model( camberwell_area_extra.base ) self.alert5 = Alert.objects.create( user=self.user, target_content_type=content_type, target_object_id=66101, last_sent=last_sent, frequency='hourly' )