Skip to content

test: improve coverage for auth and resource commands - #7

Merged
hawkfry merged 3 commits into
mainfrom
feat/test-coverage-improvements
Mar 15, 2026
Merged

hawkfry merged 3 commits into
mainfrom
feat/test-coverage-improvements

Conversation

@hawkfry

@hawkfry hawkfry commented Mar 15, 2026

Copy link
Copy Markdown
Collaborator

Why are we changing this?

The CLI had very low automated coverage in the auth/config/resource command layers, which made it hard to trust behavior without rerunning manual checks. While raising that baseline, a real issue also surfaced: omni doctor was routed incorrectly and printed usage instead of executing.

What has changed?

  • Added focused tests for auth resolution, config normalization, secret storage, PAT login helpers, API helpers, validation, and resource command behavior.
  • Added behavior tests for live-validated command paths including doctor, folders, user-attributes, users, and scim.
  • Fixed Execute routing so omni doctor runs without requiring a fake subcommand.
  • Kept the work scoped to code and tests only; the local screenshots used for reference are not part of this PR.

How to test it and expected results?

  1. Run go test ./....
    Expected: all test packages pass.

  2. Run go test ./... -coverprofile=/tmp/omni-cover.out and go tool cover -func=/tmp/omni-cover.out | tail -n 1.
    Expected: overall statement coverage reports 8.1%.

  3. Run ./bin/omni --json doctor against a configured org-auth profile.
    Expected: the command executes and returns a health summary instead of printing usage.

  4. Run ./bin/omni --json folders list, ./bin/omni --json user-attributes list, ./bin/omni --json users list-email-only --page-size 20, and ./bin/omni --json scim users list --count 20 against the sandbox.
    Expected: each command returns valid JSON responses.

Checklist:

  • My pull request represents one logical piece of work.
  • My commits are related to the pull request and look clean.
  • My code follows our coding conventions.
  • My code has appropriate tests and documentation.

@hawkfry
hawkfry merged commit c43f1fc into main Mar 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant