Skip to content

Commit 61c8d0d

Browse files
authored
add basic delete/copy tests (#275)
1 parent 1ec88ed commit 61c8d0d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/test_client.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,20 @@ def test_client_create_blob_exists(httpserver: HTTPServer):
520520
assert response == 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
521521

522522

523+
def test_client_delete(httpserver: HTTPServer):
524+
httpserver.expect_ordered_request(PrefixPattern('/api/delete'), method='DELETE').respond_with_response(Response(status=200))
525+
client = Client(httpserver.url_for('/api/delete'))
526+
response = client.delete('dummy')
527+
assert response == {'status': 'success'}
528+
529+
530+
def test_client_copy(httpserver: HTTPServer):
531+
httpserver.expect_ordered_request(PrefixPattern('/api/copy'), method='POST').respond_with_response(Response(status=200))
532+
client = Client(httpserver.url_for('/api/copy'))
533+
response = client.copy('dum', 'dummer')
534+
assert response == {'status': 'success'}
535+
536+
523537
@pytest.mark.asyncio
524538
async def test_async_client_chat(httpserver: HTTPServer):
525539
httpserver.expect_ordered_request(
@@ -992,3 +1006,19 @@ async def test_async_client_create_blob_exists(httpserver: HTTPServer):
9921006
with tempfile.NamedTemporaryFile() as blob:
9931007
response = await client._create_blob(blob.name)
9941008
assert response == 'sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
1009+
1010+
1011+
@pytest.mark.asyncio
1012+
async def test_async_client_delete(httpserver: HTTPServer):
1013+
httpserver.expect_ordered_request(PrefixPattern('/api/delete'), method='DELETE').respond_with_response(Response(status=200))
1014+
client = AsyncClient(httpserver.url_for('/api/delete'))
1015+
response = await client.delete('dummy')
1016+
assert response == {'status': 'success'}
1017+
1018+
1019+
@pytest.mark.asyncio
1020+
async def test_async_client_copy(httpserver: HTTPServer):
1021+
httpserver.expect_ordered_request(PrefixPattern('/api/copy'), method='POST').respond_with_response(Response(status=200))
1022+
client = AsyncClient(httpserver.url_for('/api/copy'))
1023+
response = await client.copy('dum', 'dummer')
1024+
assert response == {'status': 'success'}

0 commit comments

Comments
 (0)