|
10 | 10 | from datetime import datetime, timedelta, timezone |
11 | 11 |
|
12 | 12 | import pytest |
| 13 | +from grpc.aio import AioRpcError |
13 | 14 |
|
14 | 15 | from sift_client import SiftClient |
15 | 16 | from sift_client.resources import RunsAPI, RunsAPIAsync |
@@ -182,7 +183,11 @@ class TestFind: |
182 | 183 | async def test_find_run(self, runs_api_async, test_run): |
183 | 184 | """Test finding a single run.""" |
184 | 185 | # Find the same run by name |
185 | | - found_run = await runs_api_async.find(name=test_run.name) |
| 186 | + found_run = await runs_api_async.find( |
| 187 | + name=test_run.name, |
| 188 | + created_after=test_run.created_date - timedelta(seconds=10), |
| 189 | + created_before=test_run.created_date + timedelta(seconds=10), |
| 190 | + ) |
186 | 191 |
|
187 | 192 | assert found_run is not None |
188 | 193 | assert found_run.id_ == test_run.id_ |
@@ -546,38 +551,6 @@ async def test_create_adhoc_run_missing_assets(self, runs_api_async): |
546 | 551 | run_create, assets=["asset-name-not-id"], associate_new_data=False |
547 | 552 | ) |
548 | 553 |
|
549 | | - @pytest.mark.asyncio |
550 | | - async def test_create_automatic_association_for_assets(self, runs_api_async, sift_client): |
551 | | - """Test associating assets with a run for automatic data ingestion.""" |
552 | | - # Create a test run |
553 | | - run_name = f"test_run_asset_assoc_{datetime.now(timezone.utc).isoformat()}" |
554 | | - run_create = RunCreate( |
555 | | - name=run_name, |
556 | | - description="Test run for asset association", |
557 | | - tags=["sift-client-pytest"], |
558 | | - ) |
559 | | - created_run = await runs_api_async.create(run_create) |
560 | | - |
561 | | - try: |
562 | | - # Get some assets to associate |
563 | | - assets = await sift_client.async_.assets.list_(limit=2) |
564 | | - assert len(assets) >= 1 |
565 | | - |
566 | | - asset_names = [asset.name for asset in assets[:2]] |
567 | | - |
568 | | - # Associate assets with the run |
569 | | - await runs_api_async.create_automatic_association_for_assets( |
570 | | - run=created_run, asset_names=asset_names |
571 | | - ) |
572 | | - |
573 | | - # Verify the association by getting the run and checking asset_ids |
574 | | - updated_run = await runs_api_async.get(run_id=created_run.id_) |
575 | | - assert updated_run.asset_ids is not None |
576 | | - assert len(updated_run.asset_ids) >= len(asset_names) |
577 | | - |
578 | | - finally: |
579 | | - await runs_api_async.archive(created_run) |
580 | | - |
581 | 554 |
|
582 | 555 | class TestRunsAPISync: |
583 | 556 | """Test suite for the synchronous Runs API functionality. |
|
0 commit comments