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
9f449faa
Commit
9f449faa
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: tighten multimodal client response coverage
parent
d02c15e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
8 deletions
+61
-8
test_manual_multimodal_test_client.py
tests/test_manual_multimodal_test_client.py
+61
-8
No files found.
tests/test_manual_multimodal_test_client.py
View file @
9f449faa
...
...
@@ -372,20 +372,23 @@ class DummyResponse:
def
test_task5_handle_response_payload_returns_llm_text_without_artifact
(
tmp_path
):
response
=
DummyResponse
(
{
payload
=
{
"choices"
:
[{
"message"
:
{
"content"
:
"hello from model"
}}]
})
}
response
=
DummyResponse
(
payload
)
result
=
handle_response_payload
(
"llm"
,
response
,
tmp_path
)
assert
result
[
"text"
]
==
"hello from model"
assert
result
[
"artifact_path"
]
is
None
assert
result
[
"payload"
]
==
payload
def
test_task5_handle_response_payload_downloads_url_artifact
(
monkeypatch
,
tmp_path
):
response
=
DummyResponse
({
"data"
:
[{
"url"
:
"http://example.invalid/audio.wav"
}]
})
payload
=
{
"data"
:
[{
"url"
:
"http://example.invalid/audio.wav"
,
"text"
:
"generated audio summary"
}]
}
response
=
DummyResponse
(
payload
)
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client._download_artifact"
,
lambda
url
:
b
"wave-bytes"
,
...
...
@@ -395,16 +398,39 @@ def test_task5_handle_response_payload_downloads_url_artifact(monkeypatch, tmp_p
assert
result
[
"artifact_path"
]
.
suffix
==
".wav"
assert
result
[
"artifact_path"
]
.
read_bytes
()
==
b
"wave-bytes"
assert
result
[
"text"
]
==
"generated audio summary"
assert
result
[
"payload"
]
==
payload
def
test_task5_handle_response_payload_decodes_base64_artifact
(
tmp_path
):
response
=
DummyResponse
({
"data"
:
[{
"b64_json"
:
"aGVsbG8="
}]
})
payload
=
{
"data"
:
[{
"b64_json"
:
"aGVsbG8="
,
"caption"
:
"inline audio artifact"
}]
}
response
=
DummyResponse
(
payload
)
result
=
handle_response_payload
(
"audio-generation"
,
response
,
tmp_path
)
assert
result
[
"artifact_path"
]
.
read_bytes
()
==
b
"hello"
assert
result
[
"text"
]
==
"inline audio artifact"
assert
result
[
"payload"
]
==
payload
def
test_task5_handle_response_payload_downloads_video_generation_artifact_as_mp4
(
monkeypatch
,
tmp_path
):
payload
=
{
"data"
:
[{
"url"
:
"http://example.invalid/video.mp4"
,
"caption"
:
"generated video summary"
}]
}
response
=
DummyResponse
(
payload
)
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client._download_artifact"
,
lambda
url
:
b
"video-bytes"
,
)
result
=
handle_response_payload
(
"video-generation"
,
response
,
tmp_path
)
assert
result
[
"artifact_path"
]
.
suffix
==
".mp4"
assert
result
[
"artifact_path"
]
.
read_bytes
()
==
b
"video-bytes"
assert
result
[
"text"
]
==
"generated video summary"
assert
result
[
"payload"
]
==
payload
def
test_task5_execute_request_forwards_method_url_timeout_and_kwargs
(
monkeypatch
):
...
...
@@ -436,3 +462,30 @@ def test_task5_execute_request_forwards_method_url_timeout_and_kwargs(monkeypatc
"json"
:
{
"prompt"
:
"Ping"
},
},
}
def
test_task5_execute_request_filters_method_and_url_from_forwarded_kwargs
(
monkeypatch
):
captured
=
{}
def
fake_request
(
*
,
method
,
url
,
timeout
,
**
kwargs
):
captured
[
"method"
]
=
method
captured
[
"url"
]
=
url
captured
[
"timeout"
]
=
timeout
captured
[
"kwargs"
]
=
kwargs
return
"response-object"
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.requests.request"
,
fake_request
)
result
=
execute_request
({
"method"
:
"GET"
,
"url"
:
"http://127.0.0.1:6745/health"
,
"params"
:
{
"verbose"
:
"1"
},
})
assert
result
==
"response-object"
assert
captured
[
"method"
]
==
"GET"
assert
captured
[
"url"
]
==
"http://127.0.0.1:6745/health"
assert
captured
[
"timeout"
]
==
300
assert
captured
[
"kwargs"
]
==
{
"params"
:
{
"verbose"
:
"1"
}}
assert
"method"
not
in
captured
[
"kwargs"
]
assert
"url"
not
in
captured
[
"kwargs"
]
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