Bug 1284556

Summary: Pagination is ignored when requesting owner's entitlements
Product: [Community] Candlepin Reporter: Shayne Riley <sriley>
Component: candlepinAssignee: candlepin-bugs
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: low Docs Contact:
Priority: medium    
Version: 0.9CC: bcourt, vrjain
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-01 07:25:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shayne Riley 2015-11-23 15:07:08 UTC
Description of problem:

It is possible to list all active entitlements for an owner with: GET /candlepin/owners/{ownerId}/entitlements

However, if the list of entitlements is too great, it is also possible (or so I was informed) to attach the following query in order to paginate through the entitlements: ?page=1&per_page=2

However, what I'm seeing is that the page and per_page query parameters are ignored, and ALL of the entitlements are returned, no matter what.



Version-Release number of selected component (if applicable):
0.9.51.x


How reproducible:
Always


Steps to Reproduce:
1. Create (or find) an owner with at least two active entitlements. In stage, an owner fitting this constraint is 7624949.

2. Make a request to list entitlements, 1-per-page:
curl -ku $CPADMIN_USER:$CPADMIN_PASS -X GET 'http://candlepindomain/candlepin/owners/7624949/entitlements?page=1&per_page=1'

3. Count the number of entitlements returned by the request.


Actual results:
All four entitlements for owner 7624949 were returned.


Expected results:
Only the first entitlement (by creation date) should have been returned.


Additional info:
It's easier to count the results if you use jq (sudo yum install jq):

curl -ku $CPADMIN_USER:$CPADMIN_PASS -X GET 'http://candlepindomain/candlepin/owners/7624949/entitlements?page=1&per_page=1' | jq '. | length' -

(returns "4")

Comment 2 vritant 2015-12-01 07:25:12 UTC
This was fixed in Candlepin 2.0