Skip to content

Commit 0561f42

Browse files
authoredJan 21, 2025
chore: add tests for checking SHA in blob request (#425)
1 parent 7e64093 commit 0561f42

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎tests/test_client.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import base64
22
import json
33
import os
4+
import re
45
import tempfile
56
from pathlib import Path
67

@@ -618,7 +619,7 @@ def test_client_create_from_library(httpserver: HTTPServer):
618619

619620

620621
def test_client_create_blob(httpserver: HTTPServer):
621-
httpserver.expect_ordered_request(PrefixPattern('/api/blobs/'), method='POST').respond_with_response(Response(status=201))
622+
httpserver.expect_ordered_request(re.compile('^/api/blobs/sha256[:-][0-9a-fA-F]{64}$'), method='POST').respond_with_response(Response(status=201))
622623

623624
client = Client(httpserver.url_for('/'))
624625

@@ -1009,7 +1010,7 @@ async def test_async_client_create_from_library(httpserver: HTTPServer):
10091010

10101011
@pytest.mark.asyncio
10111012
async def test_async_client_create_blob(httpserver: HTTPServer):
1012-
httpserver.expect_ordered_request(PrefixPattern('/api/blobs/'), method='POST').respond_with_response(Response(status=201))
1013+
httpserver.expect_ordered_request(re.compile('^/api/blobs/sha256[:-][0-9a-fA-F]{64}$'), method='POST').respond_with_response(Response(status=201))
10131014

10141015
client = AsyncClient(httpserver.url_for('/'))
10151016

0 commit comments

Comments
 (0)