Skip to content

Test the OPA adapter's validation errors and deny / not_applicable mapping #71

Closed

Description

@imran-siddique

Checked at 3add48a.

pytest --cov=agentrust_telemetry passes (127 passed, 2 skipped), and src/agentrust_telemetry/adapters/opa.py is the least-covered module at 81%. The uncovered lines are 35, 39, 42, 45, 51, 63, 88, 90, 96 and 99.

tests/test_adapters.py:89-160 covers the allow path, the mapper requirement and malformed collections. Nothing yet tests:

  • a missing decision_id, or a mapper that returns an unsupported decision
  • non-object labels, or a missing version
  • a negative, bool or non-integer duration, and more than 32 ids
  • result: false mapping to deny and result: null mapping to not_applicable
  • a non-string timestamp, or one without the Z suffix

Done when opa.py reaches 100% line coverage under the same pytest command, each error message has its own assertion, and no source file changes. cedar.py lines 30, 37 and 65 are a fair stretch goal.

Files: tests/test_adapters.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions