Beispiel #1
0
    def test_get_votation_ids_request_uri(self):
        mock = MagicMock(return_value=RequestsResponse('ok'))
        with patch('requests.get', mock):
            get_votation_ids(year=2003)

        mock.assert_called_with(
            '{0}/voteringlista/'.format(API_URL),
            params={'sz': 10000, 'utformat': 'iddump', 'rm': '2003/04'}
        )
Beispiel #2
0
    def test_get_votation_ids_request_uri(self):
        mock = MagicMock(return_value=RequestsResponse('ok'))
        with patch('requests.get', mock):
            get_votation_ids(year=2003)

        mock.assert_called_with('{0}/voteringlista/'.format(API_URL),
                                params={
                                    'sz': 10000,
                                    'utformat': 'iddump',
                                    'rm': '2003/04'
                                })
Beispiel #3
0
    def test_get_votation_ids_parse_response(self):
        mock_votation_id = MagicMock(return_value=RequestsResponse(
            open('tests/fixtures/voteringsid-200304.csv').read()))
        with patch('requests.get', mock_votation_id):
            votation_ids = get_votation_ids(year=2003)

        self.assertEqual(len(votation_ids), 642)
        self.assertEqual(votation_ids[0],
                         'C6F70B66-5EAA-11D7-AEF9-000475503871')
        self.assertEqual(votation_ids[-1],
                         '75F2D01D-4EE1-11D7-AE75-006008577F08')
Beispiel #4
0
    def test_get_votation_ids_parse_response(self):
        mock_votation_id = MagicMock(
            return_value=RequestsResponse(
                open('tests/fixtures/voteringsid-200304.csv').read()
            )
        )
        with patch('requests.get', mock_votation_id):
            votation_ids = get_votation_ids(year=2003)

        self.assertEqual(len(votation_ids), 642)
        self.assertEqual(votation_ids[0],
                         'C6F70B66-5EAA-11D7-AEF9-000475503871')
        self.assertEqual(votation_ids[-1],
                         '75F2D01D-4EE1-11D7-AE75-006008577F08')