Skip to content

Commit

Permalink
Move paginate function test to new file test_requests_paginate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
burnash committed Mar 25, 2024
1 parent be95676 commit b1ee49a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
12 changes: 1 addition & 11 deletions tests/sources/helpers/rest_client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
from typing import Any, cast
from dlt.common.typing import TSecretStrValue
from dlt.sources.helpers.requests import Response, Request, paginate
from dlt.sources.helpers.requests import Response, Request
from dlt.sources.helpers.rest_client import RESTClient
from dlt.sources.helpers.rest_client.client import Hooks
from dlt.sources.helpers.rest_client.paginators import JSONResponsePaginator
Expand Down Expand Up @@ -167,13 +167,3 @@ def test_oauth_jwt_auth_success(self, rest_client: RESTClient):
)

assert_pagination(list(pages_iter))

def test_paginate_function(self, rest_client: RESTClient):
pages_iter = paginate(
"https://api.example.com/posts",
paginator=JSONResponsePaginator(next_url_path="next_page"),
)

pages = list(pages_iter)

assert_pagination(pages)
17 changes: 17 additions & 0 deletions tests/sources/helpers/rest_client/test_requests_paginate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest

from dlt.sources.helpers.requests import paginate
from dlt.sources.helpers.rest_client.paginators import JSONResponsePaginator
from .conftest import assert_pagination


@pytest.mark.usefixtures("mock_api_server")
def test_requests_paginate():
pages_iter = paginate(
"https://api.example.com/posts",
paginator=JSONResponsePaginator(next_url_path="next_page"),
)

pages = list(pages_iter)

assert_pagination(pages)

0 comments on commit b1ee49a

Please sign in to comment.