Skip to content

Commit c664a17

Browse files
committed
test: replace _CustomPage helper with SimpleNamespace
Removes boilerplate for the additional_data fallback test without losing coverage of that code path.
1 parent c4d6db2 commit c664a17

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

tests/tasks/test_page_iterator.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from types import SimpleNamespace
23
from unittest.mock import AsyncMock, patch, Mock
34

45
import pytest
@@ -125,24 +126,16 @@ async def test_delta_link_updated_from_final_page():
125126
assert page_iterator.delta_link == 'https://graph.microsoft.com/v1.0/delta?token=final'
126127

127128

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-
139129
@pytest.mark.asyncio
140130
async def test_delta_link_falls_back_to_additional_data():
141131
"""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."""
143135
first_page = PageResult(odata_next_link='https://graph.microsoft.com/v1.0/next', value=[1, 2])
144-
final_page = _CustomPage(
136+
final_page = SimpleNamespace(
145137
value=[3, 4],
138+
odata_next_link=None,
146139
additional_data={'@odata.deltaLink': 'https://graph.microsoft.com/v1.0/delta?token=final'},
147140
)
148141

0 commit comments

Comments
 (0)