charisma-cli 0.6.2__tar.gz → 0.6.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/PKG-INFO +1 -1
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/pyproject.toml +1 -1
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/__init__.py +1 -1
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_models.py +39 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_uploader.py +60 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/.gitignore +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/README.md +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/config.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/launch_url.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/main.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/models.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/parser.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/read_client.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/read_models.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/retry.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/subprocess_mgr.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/uploader.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/src/charisma_cli/watcher.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/__init__.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/conftest.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_bamboo_labels.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_cli.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_config.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_integration.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_launch_url.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_open_launch_payload.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_parser.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_read_client.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_read_client_attachments.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_read_client_integration.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_read_client_launches.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_read_client_pagination.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_read_client_results.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_read_client_single_result.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_retry.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_silent_mode.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_subprocess_mgr.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_testplan_cmd.py +0 -0
- {charisma_cli-0.6.2 → charisma_cli-0.6.3}/tests/test_watcher.py +0 -0
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
# is generated from pyproject.toml [project].version, so keeping this literal
|
|
5
5
|
# equal to pyproject guarantees `--version` reports the published version. The
|
|
6
6
|
# prepare-commit step owns the PATCH bump — do not hand-bump here.
|
|
7
|
-
__version__ = "0.6.
|
|
7
|
+
__version__ = "0.6.3"
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
|
+
from hypothesis import given, settings
|
|
7
|
+
from hypothesis import strategies as st
|
|
6
8
|
|
|
7
9
|
from charisma_cli.models import (
|
|
8
10
|
AttachmentRef,
|
|
@@ -266,3 +268,40 @@ class TestUploadSummary:
|
|
|
266
268
|
assert summary.attachments_sent == 3000
|
|
267
269
|
assert summary.attachments_skipped == 100
|
|
268
270
|
assert summary.containers_sent == 800
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
# Preservation (attachment-human-readable-names, Property 2 — Req 3.1).
|
|
274
|
+
# Unicode, whitespace and control characters; no lone surrogates.
|
|
275
|
+
_ANY_TEXT = st.text(alphabet=st.characters(blacklist_categories=("Cs",)), max_size=300)
|
|
276
|
+
_SOURCES = st.uuids().map(lambda u: f"{u}-attachment.json")
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class TestAttachmentRefNamePreservation:
|
|
280
|
+
"""``from_allure``: a set name is the trimmed label; a blank one falls back to the source."""
|
|
281
|
+
|
|
282
|
+
@settings(max_examples=100, deadline=None)
|
|
283
|
+
@given(name=_ANY_TEXT, source=_SOURCES)
|
|
284
|
+
def test_label_is_trimmed_name_or_source_fallback(self, name: str, source: str) -> None:
|
|
285
|
+
ref = AttachmentRef.from_allure({"source": source, "name": name, "type": "application/json"}, "r-1")
|
|
286
|
+
|
|
287
|
+
assert ref is not None
|
|
288
|
+
assert ref.name == (name.strip() or source)
|
|
289
|
+
assert ref.source == source
|
|
290
|
+
assert ref.name.strip() != ""
|
|
291
|
+
|
|
292
|
+
@settings(max_examples=50, deadline=None)
|
|
293
|
+
@given(source=_SOURCES, blank=st.one_of(st.none(), st.text(alphabet=" \t\n\r\u00a0\u3000", max_size=8)))
|
|
294
|
+
def test_missing_or_whitespace_name_resolves_to_source(self, source: str, blank: str | None) -> None:
|
|
295
|
+
attachment = {"source": source, "type": "application/json"}
|
|
296
|
+
if blank is not None:
|
|
297
|
+
attachment["name"] = blank
|
|
298
|
+
|
|
299
|
+
ref = AttachmentRef.from_allure(attachment, "r-1")
|
|
300
|
+
|
|
301
|
+
assert ref is not None
|
|
302
|
+
assert ref.name == source
|
|
303
|
+
|
|
304
|
+
@settings(max_examples=30, deadline=None)
|
|
305
|
+
@given(name=_ANY_TEXT)
|
|
306
|
+
def test_attachment_without_source_is_ignored(self, name: str) -> None:
|
|
307
|
+
assert AttachmentRef.from_allure({"name": name, "type": "image/png"}, "r-1") is None
|
|
@@ -7,7 +7,10 @@ from pathlib import Path
|
|
|
7
7
|
from queue import PriorityQueue
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
|
+
import pytest
|
|
10
11
|
import respx
|
|
12
|
+
from hypothesis import HealthCheck, given, settings
|
|
13
|
+
from hypothesis import strategies as st
|
|
11
14
|
|
|
12
15
|
from charisma_cli.config import Config
|
|
13
16
|
from charisma_cli.models import (
|
|
@@ -2279,3 +2282,60 @@ class TestAttachmentDisplayName:
|
|
|
2279
2282
|
body = self._json_body(route)
|
|
2280
2283
|
assert body["displayName"] == "actual image"
|
|
2281
2284
|
assert body["name"] == self.SOURCE
|
|
2285
|
+
|
|
2286
|
+
|
|
2287
|
+
class TestAttachmentUploadPreservation:
|
|
2288
|
+
"""Preservation (attachment-human-readable-names, Property 2 — Req 3.2, 3.3, 3.4).
|
|
2289
|
+
|
|
2290
|
+
``_upload_attachment`` truncates the label at 255, derives the content type
|
|
2291
|
+
from the on-disk filename and falls back to the filename when the label map
|
|
2292
|
+
has no entry. Only the transport (``_post_attachment``) is stubbed.
|
|
2293
|
+
"""
|
|
2294
|
+
|
|
2295
|
+
@settings(
|
|
2296
|
+
max_examples=60, deadline=None, suppress_health_check=[HealthCheck.function_scoped_fixture]
|
|
2297
|
+
)
|
|
2298
|
+
@given(
|
|
2299
|
+
label=st.text(alphabet=st.characters(blacklist_categories=("Cs",)), min_size=1, max_size=600),
|
|
2300
|
+
ext_mime=st.sampled_from(
|
|
2301
|
+
[
|
|
2302
|
+
("png", "image/png"),
|
|
2303
|
+
("json", "application/json"),
|
|
2304
|
+
("txt", "text/plain"),
|
|
2305
|
+
("zzz9", "application/octet-stream"),
|
|
2306
|
+
]
|
|
2307
|
+
),
|
|
2308
|
+
)
|
|
2309
|
+
def test_label_truncated_to_255_and_mime_from_filename(
|
|
2310
|
+
self, tmp_path: Path, label: str, ext_mime: tuple[str, str]
|
|
2311
|
+
) -> None:
|
|
2312
|
+
ext, mime = ext_mime
|
|
2313
|
+
filename = f"9f2c1a7e-attachment.{ext}"
|
|
2314
|
+
path = tmp_path / filename
|
|
2315
|
+
path.write_bytes(b"data")
|
|
2316
|
+
uploader = Uploader(_make_config(), PriorityQueue())
|
|
2317
|
+
uploader._attachment_name_map[filename] = label
|
|
2318
|
+
calls: list[tuple[tuple, dict]] = []
|
|
2319
|
+
uploader._post_attachment = lambda *a, **kw: calls.append((a, kw)) # type: ignore[method-assign]
|
|
2320
|
+
|
|
2321
|
+
uploader._upload_attachment(path, "rid-1")
|
|
2322
|
+
|
|
2323
|
+
assert len(calls) == 1
|
|
2324
|
+
args, kwargs = calls[0]
|
|
2325
|
+
assert args[0] == filename
|
|
2326
|
+
assert args[3] == mime
|
|
2327
|
+
assert kwargs["display_name"] == label[:255]
|
|
2328
|
+
assert len(kwargs["display_name"]) <= 255
|
|
2329
|
+
|
|
2330
|
+
@pytest.mark.parametrize("ext", ["png", "json"])
|
|
2331
|
+
def test_unmapped_attachment_uses_filename_as_label(self, tmp_path: Path, ext: str) -> None:
|
|
2332
|
+
filename = f"spill-error-message.{ext}"
|
|
2333
|
+
path = tmp_path / filename
|
|
2334
|
+
path.write_bytes(b"data")
|
|
2335
|
+
uploader = Uploader(_make_config(), PriorityQueue())
|
|
2336
|
+
calls: list[tuple[tuple, dict]] = []
|
|
2337
|
+
uploader._post_attachment = lambda *a, **kw: calls.append((a, kw)) # type: ignore[method-assign]
|
|
2338
|
+
|
|
2339
|
+
uploader._upload_attachment(path, "rid-1")
|
|
2340
|
+
|
|
2341
|
+
assert calls[0][1]["display_name"] == filename
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|