|
1 | 1 | import tests.mocks as mocks
|
2 | 2 | import pytest
|
| 3 | +import okta.models as models |
3 | 4 | from okta.client import Client
|
4 | 5 | from okta.request_executor import RequestExecutor
|
5 | 6 |
|
@@ -44,6 +45,33 @@ async def test_response_pagination_with_next(monkeypatch):
|
44 | 45 | await result.next()
|
45 | 46 |
|
46 | 47 |
|
| 48 | +@ pytest.mark.asyncio |
| 49 | +async def test_response_pagination_with_next_include_response(monkeypatch): |
| 50 | + ssws_client = Client({ |
| 51 | + "orgUrl": ORG_URL, |
| 52 | + "token": API_TOKEN |
| 53 | + }) |
| 54 | + |
| 55 | + req, error = await ssws_client.get_request_executor()\ |
| 56 | + .create_request("GET", |
| 57 | + GET_USERS_CALL + API_LIMIT, |
| 58 | + {}, |
| 59 | + {}) |
| 60 | + |
| 61 | + monkeypatch.setattr(RequestExecutor, 'fire_request', |
| 62 | + mocks.mock_GET_HTTP_Client_response_valid_with_next) |
| 63 | + |
| 64 | + resp, error = await ssws_client.get_request_executor().execute(req, models.User) |
| 65 | + assert resp._type is models.User |
| 66 | + monkeypatch.setattr(RequestExecutor, 'fire_request', |
| 67 | + mocks.mock_GET_HTTP_Client_response_valid) |
| 68 | + # Check next response has same type as first response and check instance types |
| 69 | + n_result, n_error, n_resp = await resp.next(includeResponse=True) |
| 70 | + assert n_resp._type is resp._type |
| 71 | + assert isinstance(n_result[0], resp._type) |
| 72 | + assert error is None and n_error is None |
| 73 | + |
| 74 | + |
47 | 75 | @ pytest.mark.asyncio
|
48 | 76 | async def test_response_pagination_with_next_not_starting_with_api(monkeypatch):
|
49 | 77 | ssws_client = Client(CLIENT_CONFIG)
|
|
0 commit comments