MCPcopy Create free account
hub / github.com/VAST-AI-Research/tripo-python-sdk / test_get_task

Method test_get_task

tests/test_client.py:162–197  ·  view source on GitHub ↗

Test getting a task.

(self, client)

Source from the content-addressed store, hash-verified

160
161 @pytest.mark.asyncio
162 async def test_get_task(self, client):
163 """Test getting a task."""
164 # Mock the response data
165 task_data = {
166 "task_id": "task-123",
167 "type": "text_to_model",
168 "status": "success",
169 "input": {"prompt": "Test prompt"},
170 "output": {
171 "model": "https://example.com/model.glb",
172 "base_model": "https://example.com/base_model.glb",
173 "pbr_model": "https://example.com/pbr_model.glb",
174 "rendered_image": "https://example.com/image.png",
175 "riggable": True
176 },
177 "progress": 100,
178 "create_time": 1625097600
179 }
180
181 # Mock the _request method
182 with patch.object(client, '_request', return_value={"code": 0, "data": task_data}):
183 task = await client.get_task("task-123")
184
185 # Check that the task was returned correctly
186 assert isinstance(task, Task)
187 assert task.task_id == "task-123"
188 assert task.type == "text_to_model"
189 assert task.status == TaskStatus.SUCCESS
190 assert task.input == {"prompt": "Test prompt"}
191 assert task.output.model == "https://example.com/model.glb"
192 assert task.output.base_model == "https://example.com/base_model.glb"
193 assert task.output.pbr_model == "https://example.com/pbr_model.glb"
194 assert task.output.rendered_image == "https://example.com/image.png"
195 assert task.output.riggable is True
196 assert task.progress == 100
197 assert task.create_time == 1625097600
198
199 @pytest.mark.asyncio
200 async def test_get_balance(self, client):

Callers

nothing calls this directly

Calls 1

get_taskMethod · 0.80

Tested by

no test coverage detected