-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add subscription_allocations property #25
Add subscription_allocations property #25
Conversation
As part of the Manifester inventory management effort, this PR adds a `subscription_allocations` property (filtered by the `username_prefix` setting) to the `Manifester` object. To enable this change, it abstracts the paginated API data processing functionaliy from the `subscription_pools` property to a helper function capable of handling GET requests to either the `allocations` or `pools` endpoints. Additionally, this PR adds a new unit test and mock endpoint to the RhsmApiStub class's `get()` method.
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.
LGTM. There's some redundancy within fetch_paginated_data
since you make the API call once and then the same steps are in the while loop. For now I think it's okay, but there's probably a better way to do this so you don't repeat the same logic.
manifest_category=manifest_data, requester=RhsmApiStub(in_dict=None, has_offset=True) | ||
) | ||
for allocation in manifester.subscription_allocations: | ||
assert allocation["name"].startswith(manifest_data["username_prefix"]) |
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.
Is there a length of allocations we should also assert for to make sure it's returning the total you expect?
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.
I don't think so. One of the end goals of this effort is to provide users with a mechanism to clean up their existing subscription allocations, particularly ones of which they are unaware (e.g. allocations that were not cleaned up properly due to test interruption). So having an expectation on the number of allocations returned would be at cross purposes to that goal, in my thinking.
@Griffin-Sullivan If I understand you correctly regarding the redundancy in |
As part of the Manifester inventory management effort, this PR adds a
subscription_allocations
property (filtered by theusername_prefix
setting) to theManifester
object. To enable this change, it abstracts the paginated API data processing functionaliy from thesubscription_pools
property to a helper function capable of handling GET requests to either theallocations
orpools
endpoints.Additionally, this PR adds a new unit test and mock endpoint to the RhsmApiStub class's
get()
method.