Skip to content

Commit

Permalink
Update members scraper so that it can run against live data sources
Browse files Browse the repository at this point in the history
The test fixture used in this case was different from the live source. I've replaced it with a copy of the original source.
  • Loading branch information
tillprochaska committed Nov 17, 2024
1 parent 1adbaac commit a47a129
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 33 deletions.
10 changes: 0 additions & 10 deletions backend/tests/scrapers/data/members/members_directory_term_8.xml

This file was deleted.

18 changes: 1 addition & 17 deletions backend/tests/scrapers/data/members/members_directory_term_9.xml

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions backend/tests/scrapers/test_members.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
from datetime import date
from pathlib import Path

import pytest

from howtheyvote.scrapers import MemberGroupsScraper, MemberInfoScraper, MembersScraper

from .helpers import load_fixture

TEST_DATA_DIR = Path(__file__).resolve().parent / "data"


@pytest.mark.always_mock_requests
def test_members_scraper(responses):
responses.get(
"https://www.europarl.europa.eu/meps/en/directory/xml/?leg=9",
Expand All @@ -20,10 +17,10 @@ def test_members_scraper(responses):
scraper = MembersScraper(term=9)
fragments = scraper.run()

assert len(fragments) == 2
assert fragments[0].group_key == 1
assert len(fragments) == 875
assert fragments[0].group_key == 197490
assert fragments[0].data.get("term") == 9
assert fragments[1].group_key == 2
assert fragments[1].group_key == 189525
assert fragments[1].data.get("term") == 9


Expand Down

0 comments on commit a47a129

Please sign in to comment.