Skip to content

Commit 6278302

Browse files
committed
Add test requested in review
1 parent 4ed3697 commit 6278302

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/integration/test_apify_storages.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from crawlee import service_locator
66
from crawlee.storages import Dataset, KeyValueStore, RequestQueue
77

8-
from apify import Configuration
8+
from apify import Actor, Configuration
99
from apify.storage_clients import ApifyStorageClient
1010

1111

@@ -55,3 +55,21 @@ async def test_unnamed_default_without_config(
5555
assert storage is storage_again
5656

5757
await storage.drop()
58+
59+
60+
@pytest.mark.parametrize(
61+
'storage_type',
62+
[Dataset, KeyValueStore, RequestQueue],
63+
)
64+
async def test_aliases_not_stored_on_platform_when_local(
65+
storage_type: Dataset | KeyValueStore | RequestQueue, apify_token: str
66+
) -> None:
67+
"""Test that default Apify storage used locally is not persisting aliases to Apify based default KVS."""
68+
service_locator.set_configuration(Configuration(token=apify_token))
69+
service_locator.set_storage_client(ApifyStorageClient())
70+
async with Actor(configure_logging=False):
71+
await storage_type.open(alias='test')
72+
default_kvs = await Actor.open_key_value_store(force_cloud=True)
73+
74+
# The default KVS should be empty
75+
assert len(await default_kvs.list_keys()) == 0

0 commit comments

Comments
 (0)