|
1 | 1 | import os |
| 2 | +from types import SimpleNamespace |
2 | 3 | from unittest.mock import AsyncMock, patch, Mock |
3 | 4 |
|
4 | 5 | import pytest |
@@ -125,24 +126,16 @@ async def test_delta_link_updated_from_final_page(): |
125 | 126 | assert page_iterator.delta_link == 'https://graph.microsoft.com/v1.0/delta?token=final' |
126 | 127 |
|
127 | 128 |
|
128 | | -class _CustomPage: # pylint: disable=too-few-public-methods |
129 | | - """A page response whose model does not declare 'odata_delta_link' and |
130 | | - instead carries it in the additional data bag, like a Kiota-generated |
131 | | - collection response that doesn't model the deltaLink property.""" |
132 | | - |
133 | | - def __init__(self, value, odata_next_link=None, additional_data=None): |
134 | | - self.value = value |
135 | | - self.odata_next_link = odata_next_link |
136 | | - self.additional_data = additional_data or {} |
137 | | - |
138 | | - |
139 | 129 | @pytest.mark.asyncio |
140 | 130 | async def test_delta_link_falls_back_to_additional_data(): |
141 | 131 | """Reproduces the gap where a model without a typed 'odata_delta_link' |
142 | | - attribute stores the delta link in additional_data instead.""" |
| 132 | + attribute stores the delta link in additional_data instead, like a |
| 133 | + Kiota-generated collection response that doesn't model the deltaLink |
| 134 | + property.""" |
143 | 135 | first_page = PageResult(odata_next_link='https://graph.microsoft.com/v1.0/next', value=[1, 2]) |
144 | | - final_page = _CustomPage( |
| 136 | + final_page = SimpleNamespace( |
145 | 137 | value=[3, 4], |
| 138 | + odata_next_link=None, |
146 | 139 | additional_data={'@odata.deltaLink': 'https://graph.microsoft.com/v1.0/delta?token=final'}, |
147 | 140 | ) |
148 | 141 |
|
|
0 commit comments