-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d8c8ad
commit 62b2807
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from requests_mock import Mocker | ||
from vercel_storage import blob | ||
|
||
|
||
def test_blob_list(requests_mock: Mocker): | ||
requests_mock.get( | ||
url="https://blob.vercel-storage.com/", | ||
status_code=200, | ||
json={ | ||
"hasMore": False, | ||
"blobs": [ | ||
{ | ||
"url": "https://c6zu0uktwgrh0d3g.public.blob.vercel-storage.com/README-PWeZ5e2SC66TZgvFcvzVOMz2ZcUqnR.md", | ||
"pathname": "README.md", | ||
"size": 263, | ||
"uploadedAt": "2023-11-14T23:26:52.759Z", | ||
"contentType": "text/markdown", | ||
"contentDisposition": 'attachment; filename="README.md"', | ||
}, | ||
{ | ||
"url": "https://c6zu0uktwgrh0d3g.public.blob.vercel-storage.com/tox-XrRb5Y3rC0H30fIXhL6yDYtTOPG8TL.ini", | ||
"pathname": "tox.ini", | ||
"size": 195, | ||
"uploadedAt": "2023-11-14T23:26:43.364Z", | ||
"contentType": "text/plain", | ||
"contentDisposition": 'attachment; filename="tox.ini"', | ||
}, | ||
], | ||
}, | ||
) | ||
|
||
contents = blob.list( | ||
options={"token": "ABCD123foobar"}, | ||
) | ||
|
||
assert requests_mock.called | ||
assert requests_mock.call_count == 1 | ||
assert [z["pathname"] for z in contents['blobs']] == ["README.md", "tox.ini"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters