From 663cb3d48c774a77fc88c626cef6a2f393900203 Mon Sep 17 00:00:00 2001 From: Parth Sareen Date: Tue, 21 Jan 2025 10:20:11 -0800 Subject: [PATCH] chore: add tests for checking SHA in blob request (#425) --- tests/test_client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index e74c936..dacb953 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,6 +1,7 @@ import base64 import json import os +import re import tempfile from pathlib import Path @@ -618,7 +619,7 @@ def test_client_create_from_library(httpserver: HTTPServer): def test_client_create_blob(httpserver: HTTPServer): - httpserver.expect_ordered_request(PrefixPattern('/api/blobs/'), method='POST').respond_with_response(Response(status=201)) + httpserver.expect_ordered_request(re.compile('^/api/blobs/sha256[:-][0-9a-fA-F]{64}$'), method='POST').respond_with_response(Response(status=201)) client = Client(httpserver.url_for('/')) @@ -1009,7 +1010,7 @@ async def test_async_client_create_from_library(httpserver: HTTPServer): @pytest.mark.asyncio async def test_async_client_create_blob(httpserver: HTTPServer): - httpserver.expect_ordered_request(PrefixPattern('/api/blobs/'), method='POST').respond_with_response(Response(status=201)) + httpserver.expect_ordered_request(re.compile('^/api/blobs/sha256[:-][0-9a-fA-F]{64}$'), method='POST').respond_with_response(Response(status=201)) client = AsyncClient(httpserver.url_for('/'))