def test_success_fetch_banks_page_2(requests_mock): results = [ { "account_number": "da8500cb8e2ffd728f919cfae8" "2b1c4e97ca2558f2545ab1b020a4172642dce3", "ip_address": "54.175.144.139", "node_identifier": "3464d43af1c920dc5fb20b1717" "431345e244035e76d3a37b4ef97e6040b9d464", "port": 80, "protocol": "http", "version": "v1.0", "default_transaction_fee": 2, "confirmation_expiration": None, "trust": "0.00", }, { "account_number": "da8500cb8e2ffd728f919cfae8" "2b1c4e97ca2558f2545ab1b020a4172642dce3", "ip_address": "34.202.233.224", "node_identifier": "3d6de056dc9ecbca2b4c832017" "dcb5dbdc2c95dd3175244acf7dfbc21add76de", "port": 80, "protocol": "http", "version": "v1.0", "default_transaction_fee": 1, "confirmation_expiration": None, "trust": "0.00", }, ] request_data = { "count": 2, "next": "http://42.0.6.9:80/banks?limit=2&offset=4", "previous": "http://42.0.6.9:80/banks?limit=2", "results": results, } requests_mock.get("http://42.0.6.9:80/banks", json=request_data) validator = Validator(address="42.0.6.9") response = validator.fetch_banks(offset=2, limit=2) assert response == request_data
def test_success_fetch_banks(requests_mock): banks = [ { "account_number": "dfddf07ec15cbf363ecb52eedd7133b" "70b3ec896b488460bcecaba63e8e36be5", "ip_address": "143.110.137.54", "node_identifier": "6dbaff44058e630cb375955c82b0d3" "bd7bc7e20cad93e74909a8951f747fb8a4", "port": None, "protocol": "http", "version": "v1.0", "default_transaction_fee": 1, "confirmation_expiration": None, "trust": "0.00", }, { "account_number": "7977b7f7a6f52bf9ebda93694d9276" "e9e23049eb40b263799fb2a35fa9316b9b", "ip_address": "143.110.141.4", "node_identifier": "735bfc11f802dbb83659987035398" "23d751ac5f5f82905143fba8a84d967f29b", "port": None, "protocol": "http", "version": "v1.0", "default_transaction_fee": 2, "confirmation_expiration": None, "trust": "0.00", }, ] results = {"count": 2, "next": None, "previous": None, "results": banks} requests_mock.get("http://42.0.6.9:80/banks", json=results) validator = Validator(address="42.0.6.9") response = validator.fetch_banks() assert response == results