-
Notifications
You must be signed in to change notification settings - Fork 741
[In- review] Improving pageable extension adding autopagination #1211
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
620da21
Improving pageable extension adding autopagination
veronicagg c3f9700
Addressing feedback
veronicagg c4c1aed
Fixing code analysis issues
veronicagg 02b714e
Fixing issue when generating spec with operationName
veronicagg 137a2f4
Addressing code review feedback
veronicagg c39f801
Merging with repo reorganization
veronicagg ccd0fa9
Merge branch 'master' into paging
veronicagg 6922d29
Addressing feedback
veronicagg 078e4a5
removing incorrectly added files and fixing a bug
veronicagg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -19,102 +19,146 @@ | |
|
|
||
| # Paging happy path tests | ||
| it 'should get single pages' do | ||
| result = @client.paging.get_single_pages_async().value! | ||
| expect(result.response.status).to eq(200) | ||
| expect(result.body.next_link).to be_nil | ||
| all_items = @client.paging.get_single_pages() | ||
| expect(all_items.count).to eq(1) | ||
| expect(all_items.is_a? Array) | ||
| expect(all_items.first.is_a? PagingModule::Models::Product) | ||
| end | ||
|
|
||
| it 'should get multiple pages' do | ||
| result = @client.paging.get_multiple_pages_async().value! | ||
| expect(result.response.status).to eq(200) | ||
| expect(result.body.next_link).not_to be_nil | ||
|
|
||
| count = 1 | ||
| while result.body.next_link != nil do | ||
| result = @client.paging.get_multiple_pages_next_async(result.body.next_link).value! | ||
| count += 1 | ||
| end | ||
| all_items = @client.paging.get_multiple_pages() #returns items from all the pages | ||
| items_count = all_items.count | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here as well & may be for all the tests #Closed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. #Closed |
||
| expect(items_count).to eq(10) | ||
| expect(all_items.is_a? Array) | ||
| expect(all_items.first.is_a? PagingModule::Models::Product) | ||
| end | ||
|
|
||
| expect(count).to eq(10) | ||
| it 'should get multiple pages - lazy' do | ||
| page = @client.paging.get_multiple_pages_as_lazy() | ||
| expect(page.is_a? PagingModule::Models::ProductResult) | ||
| expect(page.next_link).not_to be_nil | ||
| items = page.values | ||
| while page.next_link != nil do | ||
| page = page.get_next_page | ||
| items.concat(page.values) | ||
| end | ||
| expect(items.count).to eq(10) | ||
| end | ||
|
|
||
| it 'should get multiple pages with odata kind nextLink' do | ||
| result = @client.paging.get_odata_multiple_pages_async().value! | ||
| expect(result.response.status).to eq(200) | ||
| expect(result.body.odatanext_link).not_to be_nil | ||
| it 'should get multiple pages' do | ||
| all_items = @client.paging.get_odata_multiple_pages() #returns items from all the pages | ||
| items_count = all_items.count | ||
| expect(items_count).to eq(10) | ||
| expect(all_items.is_a? Array) | ||
| expect(all_items.first.is_a? PagingModule::Models::Product) | ||
| end | ||
|
|
||
| count = 1 | ||
| while result.body.odatanext_link != nil do | ||
| result = @client.paging.get_odata_multiple_pages_next_async(result.body.odatanext_link).value! | ||
| count += 1 | ||
| it 'should get multiple pages with odata - lazy ' do | ||
| page = @client.paging.get_odata_multiple_pages_as_lazy() | ||
| expect(page.is_a? PagingModule::Models::OdataProductResult) | ||
| expect(page.odatanext_link).not_to be_nil | ||
| items = page.values | ||
| while page.odatanext_link != nil do | ||
| page = page.get_next_page | ||
| items.concat(page.values) | ||
| end | ||
|
|
||
| expect(count).to eq(10) | ||
| expect(items.count).to eq(10) | ||
| end | ||
|
|
||
| it 'should get multiple pages with offset' do | ||
| options = PagingModule::Models::PagingGetMultiplePagesWithOffsetOptions.new | ||
| options.offset = 100 | ||
| result = @client.paging.get_multiple_pages_with_offset_async(options).value! | ||
| expect(result.response.status).to eq(200) | ||
| expect(result.body.next_link).not_to be_nil | ||
|
|
||
| count = 1 | ||
| while result.body.next_link != nil do | ||
| result = @client.paging.get_multiple_pages_with_offset_next_async(result.body.next_link).value! | ||
| count += 1 | ||
| end | ||
| all_items = @client.paging.get_multiple_pages_with_offset(options) | ||
| expect(all_items.count).to eq(10) | ||
| expect(all_items.is_a? Array) | ||
| expect(all_items.first.is_a? PagingModule::Models::Product) | ||
| expect(all_items.last.properties.id).to eq (110) | ||
| end | ||
|
|
||
| expect(count).to eq(10) | ||
| expect(result.body.values.last.properties.id).to eq (110) | ||
| it 'should get multiple pages with offset - lazy' do | ||
| options = PagingModule::Models::PagingGetMultiplePagesWithOffsetOptions.new | ||
| options.offset = 100 | ||
| page = @client.paging.get_multiple_pages_with_offset_as_lazy(options) | ||
| expect(page.is_a? PagingModule::Models::ProductResult) | ||
| expect(page.next_link).not_to be_nil | ||
| items = page.values | ||
| while page.next_link != nil do | ||
| page = page.get_next_page | ||
| items.concat(page.values) | ||
| end | ||
| expect(items.count).to eq(10) | ||
| expect(page.values.last.properties.id).to eq (110) | ||
| end | ||
|
|
||
| it 'should get multiple pages retry first' do | ||
| result = @client.paging.get_multiple_pages_retry_first_async().value! | ||
| expect(result.response.status).to eq(200) | ||
| expect(result.body.next_link).not_to be_nil | ||
|
|
||
| count = 1 | ||
| while result.body.next_link != nil do | ||
| result = @client.paging.get_multiple_pages_retry_first_next_async(result.body.next_link).value! | ||
| count += 1 | ||
| all_items = @client.paging.get_multiple_pages_retry_first() | ||
| expect(all_items.count).to eq(10) | ||
| expect(all_items.is_a? Array) | ||
| expect(all_items.first.is_a? PagingModule::Models::Product) | ||
| end | ||
|
|
||
| it 'should get multiple pages retry first - lazy' do | ||
| page = @client.paging.get_multiple_pages_retry_first_as_lazy | ||
| expect(page.is_a? PagingModule::Models::ProductResult) | ||
| expect(page.next_link).not_to be_nil | ||
| items = page.values | ||
| while page.next_link != nil do | ||
| page = page.get_next_page | ||
| items.concat(page.values) | ||
| end | ||
| expect(items.count).to eq(10) | ||
|
|
||
| expect(count).to eq(10) | ||
| end | ||
|
|
||
| it 'should get multiple pages retry second' do | ||
| result = @client.paging.get_multiple_pages_retry_second_async().value! | ||
| expect(result.response.status).to eq(200) | ||
| expect(result.body.next_link).not_to be_nil | ||
|
|
||
| count = 1 | ||
| while result.body.next_link != nil do | ||
| result = @client.paging.get_multiple_pages_retry_second_next_async(result.body.next_link).value! | ||
| count += 1 | ||
| end | ||
| all_items = @client.paging.get_multiple_pages_retry_second() | ||
| expect(all_items.count).to eq(10) | ||
| expect(all_items.is_a? Array) | ||
| expect(all_items.first.is_a? PagingModule::Models::Product) | ||
| end | ||
|
|
||
| expect(count).to eq(10) | ||
| it 'should get multiple pages retry second - lazy' do | ||
| page = @client.paging.get_multiple_pages_retry_second_as_lazy | ||
| expect(page.is_a? PagingModule::Models::ProductResult) | ||
| expect(page.next_link).not_to be_nil | ||
| items = page.values | ||
| while page.next_link != nil do | ||
| page = page.get_next_page | ||
| items.concat(page.values) | ||
| end | ||
| expect(items.count).to eq(10) | ||
| end | ||
|
|
||
| # Paging sad path tests | ||
| it 'should get single pages failure' do | ||
| expect { @client.paging.get_single_pages_failure_async().value! }.to raise_exception(MsRest::HttpOperationError) | ||
| expect { @client.paging.get_single_pages_failure_as_lazy }.to raise_exception(MsRest::HttpOperationError) | ||
| end | ||
|
|
||
| it 'should get single pages failure' do | ||
| expect { @client.paging.get_single_pages_failure() }.to raise_exception(MsRest::HttpOperationError) | ||
| end | ||
|
|
||
| it 'should get multiple pages failure' do | ||
| result = @client.paging.get_multiple_pages_failure_async().value! | ||
| expect(result.response.status).to eq(200) | ||
| expect(result.body.next_link).not_to be_nil | ||
| expect { @client.paging.get_multiple_pages_failure()}.to raise_exception(MsRest::HttpOperationError) | ||
| end | ||
|
|
||
| it 'should get multiple pages failure - lazy' do | ||
| page = @client.paging.get_multiple_pages_failure_as_lazy | ||
| expect(page.is_a? PagingModule::Models::ProductResult) | ||
| expect(page.next_link).not_to be_nil | ||
|
|
||
| expect { @client.paging.get_multiple_pages_failure_next_async(result.body.next_link).value! }.to raise_exception(MsRest::HttpOperationError) | ||
| expect { page.get_next_page }.to raise_exception(MsRest::HttpOperationError) | ||
| end | ||
|
|
||
| it 'should get multiple pages failure URI' do | ||
| result = @client.paging.get_multiple_pages_failure_uri_async().value! | ||
| expect(result.response.status).to eq(200) | ||
| expect(result.body.next_link).not_to be_nil | ||
| expect { @client.paging.get_multiple_pages_failure_uri()}.to raise_exception(MsRest::HttpOperationError) | ||
| end | ||
|
|
||
| it 'should get multiple pages failure URI - lazy' do | ||
| page = @client.paging.get_multiple_pages_failure_uri_as_lazy | ||
| expect(page.is_a? PagingModule::Models::ProductResult) | ||
| expect(page.next_link).not_to be_nil | ||
|
|
||
| expect { @client.paging.get_multiple_pages_failure_uri_next_async(result.body.next_link).value! }.to raise_exception(MsRest::HttpOperationError) | ||
| expect { page.get_next_page }.to raise_exception(MsRest::HttpOperationError) | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be also verifying the type of the result (all_items is of type xxx) ? #Closed
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. #Closed