Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(storeapi): Expiration date never found on a subscribed product (#327
) We observed during the attempt to integration testing with the WSL SAAS backend that we could never find the current subscription expiration date, even though we could clearly see that the user was subscribed to the product under test. It turns out that, when iterating over the product `SKU`s, we had the broken assumption `IsSubscription() && IsInUserCollection()`. In this particular example the only SKU under user's possession doesn't show `IsSubscription` as true. ![image](https://github.com/canonical/ubuntu-pro-for-windows/assets/11138291/5fe710f6-b934-4116-962e-68af5ea1cd72) Pre iteration loop (product is in user collection) ![image](https://github.com/canonical/ubuntu-pro-for-windows/assets/11138291/a37edeb8-9420-4ae4-a334-e3393dab7097) First SKU ( is subscription but not owned by the current user) ![image](https://github.com/canonical/ubuntu-pro-for-windows/assets/11138291/6d29ab4a-8d29-4d2a-bb6e-15ff79ccd3ba) Second SKU (is owned by this user, but it's not a subscription 🙃 ) ![image](https://github.com/canonical/ubuntu-pro-for-windows/assets/11138291/58140d4b-a184-4d66-a030-3279f5f36b40) So with this PR I'm relaxing on checking whether the SKU `IsSubscription` when querying the expiration date. Also, this test raised the concern that it might be possible that a user may hold several SKUs of the same product (most likely one SKU will still be valid while others will be expired). Thus, I also changed the iteration to go over all SKUs found and return the greatest expiration date (the one most towards the future) instead of stopping the iteration on the first item found in user's collection.
- Loading branch information