-
Notifications
You must be signed in to change notification settings - Fork 75
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
api: u.pro.services.list.v1 #3262
Conversation
PR ChecklistHow to use this checklistHow to use this checklistPR AuthorFor each section, check a box when it is true. PR ReviewerCheck that the PR checklist action did not fail. Bug ReferencesNone. Confirm
How to properly reference fixed bugs
Test UpdatesUnit Tests
Integration Tests
Documentation
Does this PR require review from someone outside the core ubuntu-pro-client team?
|
return ServiceListResult(services=services_list) | ||
|
||
|
||
def _get_service_status(cfg, ent, inapplicable_resources): |
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 know this problem was not introduced in this PR, but I think an entitlement should be able to tell its status. We have logic on different places that check if a service is enabled. I think we should consolidate then on the entitlement class. What do you think @orndorffgrant @renanrodrigo ?
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.
agreed, but in a separate changeset imho
bc09e9d
to
7928f80
Compare
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.
@dheyay Let's also add a description to the commit explaining what the API does
7928f80
to
001d6f5
Compare
Updated @lucasmoura |
Well you are technically adding a unit. Why wouldn't we need the test? |
001d6f5
to
bec62b8
Compare
Updated @renanrodrigo @lucasmoura |
606cd8b
to
8978583
Compare
8978583
to
0b70283
Compare
entitled = False | ||
elif contract_status == ContractStatus.ENTITLED: | ||
entitled = True | ||
available = True if ent.name not in inapplicable_resources else False |
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 think we should generally be using ent.applicability_status()
for the value of available
- right @lucasmoura @renanrodrigo ?
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 think @dheyay is just replicating the logic we have on status here. However, I think it is worth testing out replacing this logic with applicability_status
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.
It works with the applicability_status
logic and does not need the additional inapplicable_resources. Updated the implementation and the endpoint/function names @orndorffgrant
39ca3de
to
73c5558
Compare
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.
So I still think we could have a couple unit tests for the basic functionality here. The API implementation file has 0% coverage
I'm fine if we merge this without the test for now though, as we have precedents - we already have API files at 0%.
73c5558
to
fb8d457
Compare
Updated with a unit test @orndorffgrant @renanrodrigo |
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.
One minor update needed - preemptively approving
Adds an api endpoint to return the list of services with their availability, entitlement and description
uses the newly added jq filter and schema to test the api output
fb8d457
to
86dee90
Compare
Why is this needed?
Adds the following api endpoint:
u.pro.services.list.v1
Test Steps