def test_get_orders_with_custom_limit(mocker): mock_get_objects = mocker.patch.object(Api, '_get_objects') api = Api(api_key='fake-api-key', app_key='fake-app-key') order = api.get_orders(limit=20) mock_get_objects.assert_called_with( 'https://api.awsli.com.br/api/v1/pedido/search', limit=20) assert order == mock_get_objects.return_value
import logging from decouple import config from lojaintegrada import Api """ Before running this example, create a .env file with two vars: API_KEY='your-api-key' APP_KEY='your-app-key' """ logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', level=logging.DEBUG, datefmt='%I:%M:%S') api_key = config('API_KEY') app_key = config('APP_KEY') api = Api(api_key, app_key) for page in api.get_orders(situation_id=11, since_criado='2019-07-11', limit=5): import ipdb ipdb.set_trace() for obj in page['objects']: print(obj)