Пример #1
0
    def test_invalid_division_not_child_of_org(self):
        org2 = Organisation.objects.create(
            official_identifier="TEST2",
            organisation_type="local-authority",
            official_name="Test Council",
            slug="test2",
            territory_code="ENG",
            election_name="Test2 Council Local Elections",
            start_date=date(2016, 10, 1),
        )
        ElectedRole.objects.create(
            election_type=self.election_type1,
            organisation=org2,
            elected_title="Local Councillor",
            elected_role_name="Councillor for Test2 Council",
        )
        builder = ElectionBuilder("local", "2017-06-08").with_organisation(org2)

        # self.org_div_1 is not a child of org2
        # its a child of self.org1
        with self.assertRaises(OrganisationDivision.ValidationError):
            builder.with_division(self.org_div_1)
Пример #2
0
    def test_invalid_division(self):
        org2 = Organisation.objects.create(
            official_identifier='TEST2',
            organisation_type='local-authority',
            official_name="Test Council",
            gss="X00000003",
            slug="test2",
            territory_code="ENG",
            election_name="Test2 Council Local Elections",
        )
        ElectedRole.objects.create(
            election_type=self.election_type1,
            organisation=org2,
            elected_title="Local Councillor",
            elected_role_name="Councillor for Test2 Council",
        )
        builder = ElectionBuilder('local', '2017-06-08')\
            .with_organisation(org2)

        # self.org_div_1 is not a child of org2
        # its a child of self.org1
        with self.assertRaises(OrganisationDivision.ValidationError):
            builder.with_division(self.org_div_1)
Пример #3
0
 def _make_ids_for_date(date):
     x = ElectionBuilder("local", date)
     x.with_organisation(org)
     x.with_division(org_div)
     return x