-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from tsm1th/u/tsm1th-add-limit-and-offset-fea…
…tures add limit and offset features
- Loading branch information
Showing
7 changed files
with
130 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class TestPagination: | ||
"""Verify we can limit and offset results on an endpoint.""" | ||
|
||
def test_all_content_types_with_offset(self, nb_client): | ||
limit = 10 | ||
offset = 5 | ||
offset_cts = nb_client.extras.content_types.all(limit=limit, offset=offset) | ||
assert len(offset_cts) == limit | ||
|
||
def test_all_content_types_with_limit(self, nb_client): | ||
content_types = nb_client.extras.content_types.all() | ||
limited_cts = nb_client.extras.content_types.all(limit=10) | ||
assert len(content_types) == len(limited_cts) | ||
|
||
def test_filter_content_types_with_offset(self, nb_client): | ||
limit = 10 | ||
offset = 5 | ||
offset_cts = nb_client.extras.content_types.filter(app_label="dcim", limit=limit, offset=offset) | ||
assert len(offset_cts) == limit | ||
|
||
def test_filter_content_types_with_limit(self, nb_client): | ||
content_types = nb_client.extras.content_types.filter(app_label="dcim") | ||
limited_cts = nb_client.extras.content_types.filter(app_label="dcim", limit=10) | ||
assert len(content_types) == len(limited_cts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters