Пример #1
0
    def test_endpoint_member_votes(self):
        url = reverse(
            endpoints.endpoint_detail(endpoints.MEMBER_VOTES),
            kwargs={"pk": 1423},
        )

        self._assert_response_not_found(url)

        create_sample_person(parliamentdotuk=1423)
        self._assert_response_json_ok(url)
Пример #2
0
    def test_endpoint_member_full_profile(self):
        url = reverse(
            endpoints.endpoint_detail(endpoints.MEMBER_FULL_PROFILE),
            kwargs={"pk": 1423},
        )

        self._assert_response_not_found(url)

        create_sample_person(parliamentdotuk=1423)
        self._assert_response_json_ok(url)
    def setUp(self):
        dates = create_sample_dates(count=10)

        user1 = create_sample_usertoken()
        user2 = create_sample_usertoken()

        boris = create_sample_person(11, "Boris Johnson")
        keir = create_sample_person(23, "Keir Starmer")
        anna = create_sample_person(37, "Anna McMorrin")

        create_sample_vote(boris, user1, "aye", created_on=dates[0])
        create_sample_vote(keir, user1, "no", created_on=dates[1])
        create_sample_vote(boris, user2, "no", created_on=dates[2])
        create_sample_vote(keir, user2, "aye", created_on=dates[3])

        create_sample_comment(boris, user1, created_on=dates[4])
        create_sample_comment(keir, user2, created_on=dates[5])
        create_sample_comment(keir, user1, created_on=dates[6])

        _create_featured_person(anna)
Пример #4
0
    def test_get_member_for_election_result__multiple_mps_with_same_name(self):
        create_sample_person(
            pk=104467,
            name="Drew Hendry",
            constituency=Constituency.objects.get(
                pk=145020, name="Inverness, Nairn & Lochaber"),
        )
        create_sample_person(
            pk=1004467,
            name="Drew Hendry",
            constituency=Constituency.objects.get(
                pk=145915, name="Ross, Skye & Inverness West"),
        )

        result = get_member_for_election_result(
            "Drew Hendry",
            self.constituency,
            self.election,
        )

        self.assertEqual(result, self.mp)
Пример #5
0
    def setUp(self) -> None:
        create_sample_constituencies()
        create_sample_elections()

        self.constituency = Constituency.objects.get(
            pk=145021, name="Inverness, Nairn, Badenoch and Strathspey")
        self.election = Election.objects.get(pk=397,
                                             name="2019 General Election")

        self.mp = create_sample_person(4467,
                                       "Drew Hendry",
                                       constituency=self.constituency)

        create_constituency_result(self.constituency, self.election, self.mp)
Пример #6
0
    def test_endpoint_constituency_results(self):
        url = reverse(
            endpoints.endpoint_name(endpoints.CONSTITUENCY_RESULTS),
            kwargs={
                "pk": 16892,
                "election_id": 851
            },
        )

        self._assert_response_not_found(url)

        create_constituency_result_detail(
            constituency=create_sample_constituency(parliamentdotuk=16892),
            election=create_sample_election(parliamentdotuk=851),
            mp=create_sample_person(parliamentdotuk=1423),
            parliamentdotuk=5231,
        )
        self._assert_response_json_ok(url)
Пример #7
0
    def setUp(self) -> None:
        create_sample_person(
            parliamentdotuk=1557,
            name="Baroness Kramer",
        )
        create_sample_person(
            parliamentdotuk=457,
            name="Lord Pendry",
        )
        create_sample_person(
            parliamentdotuk=2758,
            name="Lord Falconer of Thoroton",
        )
        create_sample_person(
            parliamentdotuk=395,
            name="Lord Blunkett",
        )
        create_sample_person(
            parliamentdotuk=3329,
            name="Lord Brougham and Vaux",
        )
        create_sample_person(
            parliamentdotuk=3799,
            name="Lord James of Blackheath",
        )
        data = LORDS_DIVISION

        update_lords_division(data)
Пример #8
0
 def setUp(self) -> None:
     create_sample_person(wikipedia="David_Evans,_Baron_Evans_of_Watford")
     create_sample_person(wikipedia="Robert_Fellowes,_Baron_Fellowes")
     create_sample_person(wikipedia="Daniel_Finkelstein")
     create_sample_person(wikipedia="Michael_Forsyth,_Baron_Forsyth_of_Drumlean")
     create_sample_person(wikipedia="Christopher_Fox,_Baron_Fox")