Extend sample test coverage with App2App and catalog tests - #118
Open
NiklasHerrmann21 wants to merge 3 commits into
Open
NiklasHerrmann21 wants to merge 3 commits into
NiklasHerrmann21 wants to merge 3 commits into
Conversation
Cover the previously untested App2App technical user flow: a technical user whose ias_apis is mapped to the internal GetProducts policy can read the products, while a technical user with unmapped APIs is denied. The new TechnicalUser_GetProducts.json fixture complements the existing TechnicalUser.json fixture (whose APIs are intentionally unmapped).
Cover the previously untested App2App technical user flow: a technical user whose ias_apis is mapped to the internal GetProducts policy can read the products, while a technical user with unmapped APIs is denied. The new TechnicalUser_GetProducts.json fixture complements the existing TechnicalUser.json fixture (whose APIs are intentionally unmapped).
Cover the previously untested parts of the CAP bookshop: catalog reads are public (CatalogService has no @requires), the @after(READ) discount handler is applied to service reads, the submitOrder action decreases the stock and returns the new stock, and AdminService is denied for unauthenticated requests.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Extends the test coverage of the samples with scenarios that were not covered before. No production code changes — tests only.
Changes
ams-javalin-shopping+ams-spring-boot-shopping— App2App technical user flowThe App2App technical user flow (API mappers in
App2AppAuthorizationConfiguration/AuthHandler) was not exercised by any test. The checked-inTechnicalUser.jsonfixture is actually a negative case: itsias_apis(ReadProducts,ReadInvoices) are not mapped by the samples' API mappers, so a request with it is denied.Adds to both samples:
TechnicalUser_GetProducts.jsonfixture (ias_apis=["GetProducts"], which the API mapper maps to the internalGetProductspolicy thatUSEsReadProducts)GET /productswith the mapped technical user -> 200GET /productswith the unmappedTechnicalUser.jsonfixture -> 403ams-cap-bookshop— catalog + anonymous accessCatalogServicereads are public (no@requires) — previously untested@After(READ)discount handler is applied to service-level reads (books with stock > 200 get the " (discounted)" suffix)submitOrderaction (previously zero coverage) decreases the stock and returns the new stockAdminServiceis denied for unauthenticated requests (requiresManageAuthorsorManageBooks)Verification
All module test suites run green locally:
ams-javalin-shopping: 28 testsams-spring-boot-shopping: 14 testsams-cap-bookshop: 14 + 21 tests (default + customization executions)Note: building
ams-cap-bookshoplocally requires Maven >= 3.9.14 (percds-maven-plugin5.1.1); CI is unaffected.