Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
05d3ae28
Commit
05d3ae28
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: cover multimodal client response failures
parent
9f449faa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
test_manual_multimodal_test_client.py
tests/test_manual_multimodal_test_client.py
+39
-0
No files found.
tests/test_manual_multimodal_test_client.py
View file @
05d3ae28
from
tools.manual_multimodal_test_client
import
(
from
tools.manual_multimodal_test_client
import
(
MODE_DEFAULTS
,
MODE_DEFAULTS
,
_download_artifact
,
build_request_spec
,
build_request_spec
,
build_parser
,
build_parser
,
choose_mode_interactively
,
choose_mode_interactively
,
...
@@ -371,6 +372,27 @@ class DummyResponse:
...
@@ -371,6 +372,27 @@ class DummyResponse:
raise
RuntimeError
(
f
"HTTP {self.status_code}"
)
raise
RuntimeError
(
f
"HTTP {self.status_code}"
)
class
DummyDownloadResponse
:
def
__init__
(
self
,
content
,
status_code
=
200
):
self
.
content
=
content
self
.
status_code
=
status_code
def
raise_for_status
(
self
):
if
self
.
status_code
>=
400
:
raise
RuntimeError
(
f
"HTTP {self.status_code}"
)
def
test_task5_download_artifact_returns_response_content
(
monkeypatch
):
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.requests.get"
,
lambda
url
,
timeout
:
DummyDownloadResponse
(
b
"artifact-bytes"
),
)
result
=
_download_artifact
(
"http://example.invalid/artifact.bin"
)
assert
result
==
b
"artifact-bytes"
def
test_task5_handle_response_payload_returns_llm_text_without_artifact
(
tmp_path
):
def
test_task5_handle_response_payload_returns_llm_text_without_artifact
(
tmp_path
):
payload
=
{
payload
=
{
"choices"
:
[{
"message"
:
{
"content"
:
"hello from model"
}}]
"choices"
:
[{
"message"
:
{
"content"
:
"hello from model"
}}]
...
@@ -433,6 +455,23 @@ def test_task5_handle_response_payload_downloads_video_generation_artifact_as_mp
...
@@ -433,6 +455,23 @@ def test_task5_handle_response_payload_downloads_video_generation_artifact_as_mp
assert
result
[
"payload"
]
==
payload
assert
result
[
"payload"
]
==
payload
def
test_task5_handle_response_payload_propagates_http_errors
(
tmp_path
):
response
=
DummyResponse
({
"error"
:
"bad request"
},
status_code
=
500
)
with
pytest
.
raises
(
RuntimeError
,
match
=
r"HTTP 500"
):
handle_response_payload
(
"llm"
,
response
,
tmp_path
)
def
test_task5_handle_response_payload_rejects_generation_without_artifact_fields
(
tmp_path
):
payload
=
{
"data"
:
[{
"text"
:
"generated audio summary"
}]
}
response
=
DummyResponse
(
payload
)
with
pytest
.
raises
(
ValueError
,
match
=
r"No artifact found in generation response for mode: audio-generation"
):
handle_response_payload
(
"audio-generation"
,
response
,
tmp_path
)
def
test_task5_execute_request_forwards_method_url_timeout_and_kwargs
(
monkeypatch
):
def
test_task5_execute_request_forwards_method_url_timeout_and_kwargs
(
monkeypatch
):
captured
=
{}
captured
=
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment