Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for PageIterator in test_pagination.py #1256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion tests/test_pagination.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from pynamodb.pagination import RateLimiter
from pynamodb.pagination import RateLimiter, PageIterator


class MockTime():
Expand Down Expand Up @@ -77,3 +77,25 @@ def test_basic_rate_limiting_large_increment():

# The operation takes longer than the minimum wait, so rate limiting should have no effect
assert mock_time.time() == 1100.0


def test_page_iterator_with_rate_limit():
def mock_operation():
pass

args = None
kwargs = {'exclusive_start_key': None}
rate_limit = 0.1
page_iter = PageIterator(mock_operation, args, kwargs, rate_limit)
assert page_iter._rate_limiter.rate_limit == rate_limit


def test_page_iterator_page_size_getter():
page_iter = PageIterator(None, None, {'limit': 10})
assert page_iter.page_size == 10


def test_page_iterator_page_size_setter():
page_iter = PageIterator(None, None, {})
page_iter.page_size = 20
assert page_iter._kwargs['limit'] == 20
Loading