mengw15 opened a new pull request, #7652:
URL: https://github.com/apache/texera/pull/7652
### What changes were proposed in this PR?
Adds specs for two amber classes that had none. No production code was
changed.
**`GuestAuthFilterSpec`** (+8 tests) — pure, no database. The filter is built
through its `Builder` with a small test authorizer, run over a stubbed
`ContainerRequestContext`, and the `SecurityContext` it installs is captured
and
asserted:
- `getUserPrincipal` is a `SessionUser` wrapping `GuestAuthFilter.GUEST`;
- `isUserInRole` delegates to the authorizer — both an allowed and a denied
role;
- `isSecure` inherits from the incoming context — secure, insecure, and the
**null** incoming context the code guards for;
- `getAuthenticationScheme` reflects the scheme `filter()` authenticates
with.
Plus the `GUEST` preset's fields and `Builder` returning a fresh filter each
time.
**`UserResourceSpec`** (+7 tests) — jOOQ against embedded Postgres via
`MockTexeraDB`:
- `isJoiningReasonRequired` — true while unset, false once stored, and a 404
`WebApplicationException` for an unknown uid;
- `updateJoiningReason` — persists affiliation/reason and flips the prompt
off,
trims both values, and defaults a null affiliation to an empty string.
Two branches the issue does not mention are covered as well, since they are
the
guard `updateJoiningReason` opens with: a blank/whitespace reason and a null
reason each raise 400, and the blank case is asserted to leave the stored
user
untouched.
### Any related issues, documentation, discussions?
Closes #7650
### How was this PR tested?
Unit tests, run locally (the `UserResource` half against embedded Postgres).
All
pass, and the failure path was verified by breaking an assertion to confirm
the
suite goes red:
```
sbt "WorkflowExecutionService/testOnly *GuestAuthFilterSpec
*UserResourceSpec"
# Tests: succeeded 33, failed 0
sbt "WorkflowExecutionService/Test/scalafmtCheck" # clean
sbt "WorkflowExecutionService/Test/scalafix --check" # clean
```
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]