Tests listing versions of an artifact.
(service_type, artifact_service_factory)
| 355 | ], |
| 356 | ) |
| 357 | async def test_list_versions(service_type, artifact_service_factory): |
| 358 | """Tests listing versions of an artifact.""" |
| 359 | artifact_service = artifact_service_factory(service_type) |
| 360 | |
| 361 | app_name = "app0" |
| 362 | user_id = "user0" |
| 363 | session_id = "123" |
| 364 | filename = "with/slash/filename" |
| 365 | versions = [ |
| 366 | types.Part.from_bytes( |
| 367 | data=i.to_bytes(2, byteorder="big"), mime_type="text/plain" |
| 368 | ) |
| 369 | for i in range(3) |
| 370 | ] |
| 371 | versions.append(types.Part.from_text(text="hello")) |
| 372 | |
| 373 | for i in range(4): |
| 374 | await artifact_service.save_artifact( |
| 375 | app_name=app_name, |
| 376 | user_id=user_id, |
| 377 | session_id=session_id, |
| 378 | filename=filename, |
| 379 | artifact=versions[i], |
| 380 | ) |
| 381 | |
| 382 | response_versions = await artifact_service.list_versions( |
| 383 | app_name=app_name, |
| 384 | user_id=user_id, |
| 385 | session_id=session_id, |
| 386 | filename=filename, |
| 387 | ) |
| 388 | |
| 389 | assert response_versions == list(range(4)) |
| 390 | |
| 391 | |
| 392 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected