def test_misconfigured_search(court_scraper_dir, headless): with pytest.raises(SearchConfigurationError): place_id = 'wi_milwaukee' site = WicourtsSite(place_id, 'DUMMY_CAPTCHA_API_KEY') kwargs = { 'headless': headless, 'download_dir': court_scraper_dir, } site.search(**kwargs)
def test_misconfigured_search(court_scraper_dir, headless): with pytest.raises(SearchConfigurationError): place_id = "wi_milwaukee" site = WicourtsSite(place_id, "DUMMY_CAPTCHA_API_KEY") kwargs = { "headless": headless, "download_dir": court_scraper_dir, } site.search(**kwargs)
def test_multiname_county_case_number(court_scraper_dir, headless): place_id = "wi_green_lake" site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { 'case_numbers': ['2021CV000055'], 'download_dir': court_scraper_dir, 'headless': headless, } results = site.search(**kwargs) assert len(results) == 1
def test_case_number_search(court_scraper_dir, headless): case_numbers = ['2021CV003851', '2021CV003850'] place_id = 'wi_milwaukee' site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { 'headless': headless, 'case_numbers': case_numbers, 'download_dir': court_scraper_dir, } results = site.search(**kwargs) assert len(results) == 2
def test_case_number_search(court_scraper_dir, headless): case_numbers = ["2021CV003851", "2021CV003850"] place_id = "wi_milwaukee" site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { "headless": headless, "case_numbers": case_numbers, "download_dir": court_scraper_dir, } results = site.search(**kwargs) assert len(results) == 2
def test_multiname_county_date_search(court_scraper_dir, headless): day = "2021-06-22" place_id = "wi_green_lake" site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { 'start_date': day, 'end_date': day, 'download_dir': court_scraper_dir, 'headless': headless, } results = site.search(**kwargs) assert len(results) == 5
def test_search_no_results(court_scraper_dir, headless): day = "2021-06-27" # Sunday place_id = "wi_forest" site = WicourtsSite(place_id, 'DUMMY_CAPTCHA_API_KEY') kwargs = { 'start_date': day, 'end_date': day, 'download_dir': court_scraper_dir, 'headless': headless, } results = site.search(**kwargs) assert len(results) == 0
def test_search_no_results(court_scraper_dir, headless): day = "2021-06-27" # Sunday place_id = "wi_forest" site = WicourtsSite(place_id, "DUMMY_CAPTCHA_API_KEY") kwargs = { "start_date": day, "end_date": day, "download_dir": court_scraper_dir, "headless": headless, } results = site.search(**kwargs) assert len(results) == 0
def test_search_with_multiple_case_types_multiple_results( court_scraper_dir, headless): # Forest "2021-07-01" has 4 cases with 3 case types (TR, SC, FO) day = "2021-07-01" place_id = "wi_forest" site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { 'start_date': day, 'end_date': day, 'case_types': ['SC', 'TR'], 'download_dir': court_scraper_dir, 'headless': headless, } results = site.search(**kwargs) assert len(results) == 3
def test_search_with_multiple_case_types_multiple_results( court_scraper_dir, headless): # Forest "2021-07-01" has 4 cases with 3 case types (TR, SC, FO) day = "2021-07-01" place_id = "wi_forest" site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { "start_date": day, "end_date": day, "case_types": ["SC", "TR"], "download_dir": court_scraper_dir, "headless": headless, } results = site.search(**kwargs) assert len(results) == 3
def test_search_multiple_days_with_details(court_scraper_dir, headless): # Forest "2021-06-24" has 2 cases # Forest "2021-06-23" has 4 cases start = "2021-06-23" end = "2021-06-24" # Test with a smaller county place_id = "wi_forest" # wi_milwaukee" site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { 'start_date': start, 'end_date': end, 'headless': headless, 'download_dir': court_scraper_dir, } results = site.search(**kwargs) assert len(results) == 6
def test_search_case_type_single_result(court_scraper_dir, headless): # Forest "2021-07-01" has 4 cases with 3 case types (TR, SC, FO) # One of them are is SC # Searches with single results redirect straight to case detail page day = "2021-07-01" place_id = "wi_forest" site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { 'start_date': day, 'end_date': day, 'case_types': ['SC'], 'download_dir': court_scraper_dir, 'headless': headless, } results = site.search(**kwargs) assert len(results) == 1
def test_search_with_case_details(court_scraper_dir, headless): # Forest "2021-06-30" has 2 cases # Adams "2021-06-16" has 4 cases # Milwaukee "2021-07-31" has 346 cases! day = "2021-06-30" # Test with a smaller county place_id = "wi_forest" # wi_milwaukee" site = WicourtsSite(place_id, CAPTCHA_API_KEY) kwargs = { 'start_date': day, 'end_date': day, 'headless': headless, 'download_dir': court_scraper_dir, } results = site.search(**kwargs) assert len(results) == 2