def us_census_stream(): return UsCensusStream( query_params={}, query_path="data/test", api_key="MY_API_KEY", authenticator=NoAuth(), )
def test_discover_schema(us_census_stream: UsCensusStream, response: str, expected_schema: dict): responses.add( responses.GET, f"{us_census_stream.url_base}{us_census_stream.query_path}", body=response, ) assert us_census_stream.get_json_schema().get("properties") == expected_schema
def test_parse_response(us_census_stream: UsCensusStream, response: str, expected_result: dict): responses.add( responses.GET, us_census_stream.url_base, body=response, ) resp = requests.get(us_census_stream.url_base) assert list(us_census_stream.parse_response(resp)) == expected_result