Exemplo n.º 1
0
def test_fetch_bill_list():
    with mock_get_request() as mock_get:
        fetch.bills()

    url, headers = url_and_headers_from_mock_get_request(mock_get)
    assert_valid_openstates_url_and_headers(url, headers)
    assert url.path == '/graphql'
    query = parse_qs(url.query)
    assert query['state'] == ['tx']
    assert query['search_window'] == ['session']
    assert query['page'] == ['1']
    assert query['per_page'] == [str(fetch.DEFAULT_BILL_COUNT)]
Exemplo n.º 2
0
 def _fetch_bills(self, options):
     """Return list of bill data from Open States API."""
     bill_count = options['max'] or fetch.DEFAULT_BILL_COUNT
     if options['session']:
         search_window = 'session:{}'.format(options['session'])
     else:
         search_window = 'session'
     return fetch.bills(per_page=bill_count, search_window=search_window)
 def _fetch_bills(self, options):
     """Return list of bill data from Open States API."""
     bill_count = options['max'] or fetch.DEFAULT_BILL_COUNT
     return fetch.bills(per_page=bill_count)
Exemplo n.º 4
0
 def _fetch_bills(self, startCursor, options):
     """Return list of bill data from Open States API."""
     # print(f'Requesting {options["Max"]} starting at cursor: {startCursor}')
     return fetch.bills(startCursor, options)