|
1 | 1 | # -*- coding: utf-8 -*- |
2 | | -# (C) Copyright IBM Corp. 2021. |
| 2 | +# (C) Copyright IBM Corp. 2021, 2022. |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
@@ -148,18 +148,22 @@ def test_list_account_groups_example(self): |
148 | 148 | assert enterprise_id is not None |
149 | 149 |
|
150 | 150 | try: |
151 | | - |
152 | 151 | print('\nlist_account_groups() result:') |
153 | 152 | # begin-list_account_groups |
154 | 153 |
|
155 | | - list_account_groups_response = enterprise_management_service.list_account_groups( |
| 154 | + all_results = [] |
| 155 | + pager = AccountGroupsPager( |
| 156 | + client=enterprise_management_service, |
156 | 157 | enterprise_id=enterprise_id, |
157 | | - ).get_result() |
| 158 | + ) |
| 159 | + while pager.has_next(): |
| 160 | + next_page = pager.get_next() |
| 161 | + assert next_page is not None |
| 162 | + all_results.extend(next_page) |
158 | 163 |
|
159 | | - print(json.dumps(list_account_groups_response, indent=2)) |
| 164 | + print(json.dumps(all_results, indent=2)) |
160 | 165 |
|
161 | 166 | # end-list_account_groups |
162 | | - |
163 | 167 | except ApiException as e: |
164 | 168 | pytest.fail(str(e)) |
165 | 169 |
|
@@ -276,14 +280,19 @@ def test_list_accounts_example(self): |
276 | 280 | print('\nlist_accounts() result:') |
277 | 281 | # begin-list_accounts |
278 | 282 |
|
279 | | - list_accounts_response = enterprise_management_service.list_accounts( |
| 283 | + all_results = [] |
| 284 | + pager = AccountsPager( |
| 285 | + client=enterprise_management_service, |
280 | 286 | enterprise_id=enterprise_id, |
281 | | - ).get_result() |
| 287 | + ) |
| 288 | + while pager.has_next(): |
| 289 | + next_page = pager.get_next() |
| 290 | + assert next_page is not None |
| 291 | + all_results.extend(next_page) |
282 | 292 |
|
283 | | - print(json.dumps(list_accounts_response, indent=2)) |
| 293 | + print(json.dumps(all_results, indent=2)) |
284 | 294 |
|
285 | 295 | # end-list_accounts |
286 | | - |
287 | 296 | except ApiException as e: |
288 | 297 | pytest.fail(str(e)) |
289 | 298 |
|
@@ -374,14 +383,19 @@ def test_list_enterprises_example(self): |
374 | 383 | print('\nlist_enterprises() result:') |
375 | 384 | # begin-list_enterprises |
376 | 385 |
|
377 | | - list_enterprises_response = enterprise_management_service.list_enterprises( |
| 386 | + all_results = [] |
| 387 | + pager = EnterprisesPager( |
| 388 | + client=enterprise_management_service, |
378 | 389 | account_id=enterprise_account_id, |
379 | | - ).get_result() |
| 390 | + ) |
| 391 | + while pager.has_next(): |
| 392 | + next_page = pager.get_next() |
| 393 | + assert next_page is not None |
| 394 | + all_results.extend(next_page) |
380 | 395 |
|
381 | | - print(json.dumps(list_enterprises_response, indent=2)) |
| 396 | + print(json.dumps(all_results, indent=2)) |
382 | 397 |
|
383 | 398 | # end-list_enterprises |
384 | | - |
385 | 399 | except ApiException as e: |
386 | 400 | pytest.fail(str(e)) |
387 | 401 |
|
|
0 commit comments