Skip to content

Test Model Target error responses through vws-python-mock #3169

Description

@adamtheturtle

Summary

Once VWS-Python/vws-python-mock#3495 provides configurable Model Target failure responses, use that public capability to test the synchronous and asynchronous Model Target clients through their normal HTTP paths.

Motivation

The Model Target response handler currently leaves these reachable branches excluded from coverage:

  • HTTP 429 → TooManyRequestsError;
  • HTTP 5xx → ServerError.

Invalid bearer-token behavior is covered with a custom _BadTokenTransport, and generic ModelTargetError envelope parsing is tested by constructing exceptions directly. Those unit tests are useful, but they do not prove the complete request → transport → response mapping path against the supported mock.

This also blocks VWS-Python/vws-cli#2513 from exercising all Model Target CLI error handling through public commands without coverage exclusions.

Scope

After VWS-Python/vws-python-mock#3495 is released:

  • update the mock development dependency;
  • add sync and async integration tests for a raw authentication failure after OAuth succeeds;
  • add sync and async tests for generic JSON and non-JSON 4xx responses mapping to ModelTargetError;
  • add sync and async tests for 429 mapping to TooManyRequestsError;
  • add sync and async tests for 5xx mapping to ServerError;
  • remove the corresponding # pragma: no cover annotations;
  • retain lower-level envelope parsing tests where they provide distinct value.

Acceptance criteria

  • Both ModelTargetService and AsyncModelTargetService are exercised through MockVWS for authentication, generic 4xx, 429, and 5xx failures.
  • Assertions cover exception type and preserved response status/body.
  • No reachable Model Target response-mapping branch is excluded from coverage.
  • No client method patching is introduced.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions