Exemplo n.º 1
0
    def test_invalid_organisation(self):
        builder = ElectionBuilder('local', '2017-06-08')

        # delete the relationship between org1 and local elections
        self.elected_role1.delete()

        with self.assertRaises(Organisation.ValidationError):
            builder.with_organisation(self.org1)
    def test_organisation_date_range_invalid(self):
        builder = ElectionBuilder("local", "2001-01-01")

        # delete the relationship between org1 and local elections
        self.elected_role1.delete()

        with self.assertRaises(Organisation.ValidationError):
            builder.with_organisation(self.org1)
Exemplo n.º 3
0
    def test_eq(self):
        eb1 = ElectionBuilder('local', '2017-06-08')

        eb2 = ElectionBuilder('local', '2017-06-08')\
            .with_source('foo/bar.baz')\
            .with_snooped_election(7)

        # these should be 'equal' because only the meta-data differs
        self.assertEqual(eb1, eb2)

        eb2 = eb2.with_organisation(self.org1)

        # now these objects will build funamentally different elections
        self.assertNotEqual(eb1, eb2)
Exemplo n.º 4
0
 def _make_ids_for_date(date):
     x = ElectionBuilder("local", date)
     x.with_organisation(org)
     x.with_division(org_div)
     return x