Repository navigation
test(auth-app): cover custom labels of app tokens and document the label parameter - #4114
Conversation
…bel parameter Assisted-by: Claude Code:claude-opus-5-5
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
🟢 Coverage ∅ diff coverage · +0.01% coverage variation
Metric Results Coverage variation ✅ +0.01% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (0b73e9e) 95037 29280 30.81% Head commit (05933a6) 95037 (+0) 29292 (+12) 30.82% (+0.01%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#4114) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
pbleser-oc
left a comment
There was a problem hiding this comment.
Thanks, looks good to me. Nice that the README example now shows the labels the code really produces.
Description
POST /auth-app/tokensaccepts an optionallabelquery parameter: without it the label isGenerated via API, and tokens created through impersonation always get(Impersonation)appended, also to a custom label. Neither the README nor any test covered this. This PR adds:TestHandleCreateLabelinservices/auth-app/pkg/service/service_test.go): no label, an empty label, a custom label, a unicode label, impersonation without a label, and impersonation with a custom label (WebDAV sync (Impersonation)). Each case checks the label passed to the gateway and the one in the response.apiAuthApp/token.feature): a user creates a token with a custom label, and an admin creates one with a custom label for another user. Two new steps inAuthAppContext.php.labelparameter, its default and the(Impersonation)suffix. It also fixes the list example, which showed a label (Generated via Impersonation API) the service never produces.No change to the service code.
Related Issue
Motivation and Context
The web client already sends a label when a user creates an app token, and shows it in the token list. Without tests, a change that drops the label or the
(Impersonation)suffix would go unnoticed. API users had no documentation of the parameter.How Has This Been Tested?
go test -race ./services/auth-app/...passes. The new tests pass as the behaviour already exists. To check that they catch regressions, I changed the handler locally (not part of this PR) to ignorelabel: the three custom-label cases fail. Changing it to drop the suffix on a custom label makes the impersonation case fail.go vet ./services/auth-app/...reports nothing.gofmtandgit diff --checkare clean.golangci-lintand the acceptance tests (the new scenarios run in CI).Types of changes
Checklist:
AI assistance: Claude Code (claude-opus-5-5) wrote the first draft of the tests, the README changes and this description; I reviewed and adjusted them.