def test_get_all_calls_get_with_uri_and_params(self, mock_session, mock_get_all_response): mock_session.get.side_effect = [mock_get_all_response] client = UserClient(mock_session) for _ in client.get_all(): break first_call = mock_session.get.call_args_list[0] assert first_call[0][0] == USER_URI assert first_call[1]["params"] == DEFAULT_GET_ALL_PARAMS
def test_get_all_calls_get_expected_number_of_times( self, mock_session, mock_get_all_response, mock_get_all_empty_response): py42.settings.items_per_page = 1 client = UserClient(mock_session) mock_session.get.side_effect = [ mock_get_all_response, mock_get_all_response, mock_get_all_empty_response, ] for _ in client.get_all(): pass py42.settings.items_per_page = 1000 assert mock_session.get.call_count == 3