MCPcopy Create free account
hub / github.com/vastsa/FileCodeBox / S3FileExistsTests

Class S3FileExistsTests

tests/test_issue_478_s3_file_exists.py:26–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26class S3FileExistsTests(unittest.TestCase):
27 def test_file_exists_falls_back_to_list_objects(self):
28 client = FakeS3Client({"Contents": [{"Key": "share/data/file.txt"}]})
29 storage = S3FileStorage.__new__(S3FileStorage)
30 storage.bucket_name = "bucket"
31 storage._client = lambda: client
32
33 exists = asyncio.run(storage.file_exists("share/data/file.txt"))
34
35 self.assertTrue(exists)
36 self.assertEqual(client.head_calls, 3)
37
38 def test_file_exists_returns_false_when_missing(self):
39 client = FakeS3Client({"Contents": [{"Key": "share/data/other.txt"}]})
40 storage = S3FileStorage.__new__(S3FileStorage)
41 storage.bucket_name = "bucket"
42 storage._client = lambda: client
43
44 exists = asyncio.run(storage.file_exists("share/data/file.txt"))
45
46 self.assertFalse(exists)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected