-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Paginate Manager API calls (#320)
* chore: Paginate Manager API calls * Addressing PR feedbak
- Loading branch information
1 parent
4deefb7
commit 3e7950a
Showing
3 changed files
with
115 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,7 @@ def test_preset_client_export_users(requests_mock: Mocker) -> None: | |
}, | ||
) | ||
requests_mock.get( | ||
"https://ws.preset.io/v1/teams/team1/workspaces/2/memberships", | ||
"https://ws.preset.io/v1/teams/team1/workspaces/2/memberships?page_number=1&page_size=250", | ||
json={ | ||
"payload": [ | ||
{ | ||
|
@@ -110,6 +110,16 @@ def test_preset_client_export_users(requests_mock: Mocker) -> None: | |
"email": "[email protected]", | ||
}, | ||
}, | ||
], | ||
"meta": { | ||
"count": 251, | ||
}, | ||
}, | ||
) | ||
requests_mock.get( | ||
"https://ws.preset.io/v1/teams/team1/workspaces/2/memberships?page_number=2&page_size=250", | ||
json={ | ||
"payload": [ | ||
{ | ||
"user": { | ||
"username": "cdoe", | ||
|
@@ -119,8 +129,12 @@ def test_preset_client_export_users(requests_mock: Mocker) -> None: | |
}, | ||
}, | ||
], | ||
"meta": { | ||
"count": 251, | ||
}, | ||
}, | ||
) | ||
|
||
requests_mock.get( | ||
"https://superset.example.org/roles/add", | ||
text=""" | ||
|
@@ -271,7 +285,7 @@ def test_get_team_members(requests_mock: Mocker) -> None: | |
Test the ``get_team_members`` method. | ||
""" | ||
requests_mock.get( | ||
"https://ws.preset.io/v1/teams/botafogo/memberships", | ||
"https://ws.preset.io/v1/teams/botafogo/memberships?page_number=1&page_size=250", | ||
json={ | ||
"payload": [ | ||
{ | ||
|
@@ -290,6 +304,16 @@ def test_get_team_members(requests_mock: Mocker) -> None: | |
"email": "[email protected]", | ||
}, | ||
}, | ||
], | ||
"meta": { | ||
"count": 251, | ||
}, | ||
}, | ||
) | ||
requests_mock.get( | ||
"https://ws.preset.io/v1/teams/botafogo/memberships?page_number=2&page_size=250", | ||
json={ | ||
"payload": [ | ||
{ | ||
"user": { | ||
"username": "cdoe", | ||
|
@@ -299,6 +323,9 @@ def test_get_team_members(requests_mock: Mocker) -> None: | |
}, | ||
}, | ||
], | ||
"meta": { | ||
"count": 251, | ||
}, | ||
}, | ||
) | ||
|
||
|
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 |
---|---|---|
|
@@ -1881,7 +1881,7 @@ def test_export_users_preset(requests_mock: Mocker) -> None: | |
}, | ||
) | ||
requests_mock.get( | ||
"https://api.app.preset.io/v1/teams/team1/workspaces/1/memberships", | ||
"https://api.app.preset.io/v1/teams/team1/workspaces/1/memberships?page_number=1&page_size=250", | ||
json={ | ||
"payload": [ | ||
{ | ||
|
@@ -1901,14 +1901,38 @@ def test_export_users_preset(requests_mock: Mocker) -> None: | |
}, | ||
}, | ||
], | ||
"meta": { | ||
"count": 251, | ||
}, | ||
}, | ||
) | ||
|
||
requests_mock.get( | ||
"https://api.app.preset.io/v1/teams/team1/workspaces/1/memberships?page_number=2&page_size=250", | ||
json={ | ||
"payload": [ | ||
{ | ||
"user": { | ||
"username": "cdoe", | ||
"first_name": "Clarisse", | ||
"last_name": "Doe", | ||
"email": "[email protected]", | ||
}, | ||
}, | ||
], | ||
"meta": { | ||
"count": 251, | ||
}, | ||
}, | ||
) | ||
|
||
requests_mock.get( | ||
"https://superset.example.org/roles/add", | ||
text=""" | ||
<select id="user"> | ||
<option value="1">Alice Doe</option> | ||
<option value="2">Bob Doe</option> | ||
<option value="3">Clarisse Doe</option> | ||
</select> | ||
""", | ||
) | ||
|
@@ -1932,6 +1956,14 @@ def test_export_users_preset(requests_mock: Mocker) -> None: | |
"email": "[email protected]", | ||
"role": [], | ||
}, | ||
{ | ||
"id": 3, | ||
"first_name": "Clarisse", | ||
"last_name": "Doe", | ||
"username": "cdoe", | ||
"email": "[email protected]", | ||
"role": [], | ||
}, | ||
] | ||
|
||
|
||
|