Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,30 @@ Run `th-cli test-run-execution --id {id}` with a test run execution id to fetch

For JSON respond, add `--json` to the command.

### Test Run Execution Repeat

Run `th-cli test-run-execution repeat --id {id}` to create a new test run execution with
the same selected tests and config as an existing one, then start it and attach to it the
same way `run-tests` does (and the frontend's "Repeat" action does): streaming live test
progress and forwarding any user prompts to this terminal. Use `--title` to override the
generated title (defaults to the original title with an updated timestamp; the backend
always appends a timestamp regardless). As with `run-tests`, `--no-color` disables colored
output and `--no-streaming` disables the real-time web log viewer (enabled by default) for
the new execution.

### Test Run Execution Export

Run `th-cli test-run-execution export --id {id}` to export a test run execution's config
and results to a JSON file. Use `--output-file` to override the default filename
(`<execution-title>-execution.json`).

### Test Run Execution Import

Run `th-cli test-run-execution import --file {file} --project-id {id}` to import a test
run execution previously written by `test-run-execution export` into the given project.
The backend rejects the import if the file's `db_revision` doesn't match the destination
instance's current database revision.

### Project Create

Run `th-cli project create --name {project name} --config {config file}` to create a new project. Project name is required.
Expand Down
27 changes: 27 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,33 @@ def capture(**kwargs):

assert captured_host[0].startswith("http://")

def test_timeout_not_passed_when_omitted(self):
"""When no timeout is given, ApiClient is not passed a 'timeout' kwarg (httpx's
own default applies)."""
from th_cli.client import get_client

with patch("th_cli.client.ApiClient") as mock_cls:
mock_cls.return_value = MagicMock()
get_client()

assert "timeout" not in mock_cls.call_args.kwargs

def test_timeout_forwarded_to_api_client(self):
"""An explicit timeout is forwarded to ApiClient (and from there to the
underlying httpx.AsyncClient), instead of callers having to poke
client._async_client.timeout after construction."""
from httpx import Timeout

from th_cli.client import get_client

custom_timeout = Timeout(120.0, connect=10.0)

with patch("th_cli.client.ApiClient") as mock_cls:
mock_cls.return_value = MagicMock()
get_client(timeout=custom_timeout)

assert mock_cls.call_args.kwargs.get("timeout") == custom_timeout


# ---------------------------------------------------------------------------
# Module-level client fallback
Expand Down
Loading
Loading