Skip to content

Commit

Permalink
WIP testing with a mock bucket, it can happen
Browse files Browse the repository at this point in the history
  • Loading branch information
metazool committed Aug 20, 2024
1 parent b238d5d commit c4bb81d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
async def mock_s3_client():
with mock_aws():
session = aioboto3.Session(region_name="us-east-1")
async with session.client("s3", region_name="us-east-1") as client: # type: S3Client
yield client
yield session
# async with session.client("s3", region_name="us-east-1") as client: # type: S3Client
# yield client


7 changes: 5 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from fastapi import FastAPI
from fastapi.testclient import TestClient

# TODO resolve how moto should work with aioboto3 Session + fastapi dependency overrides


client = TestClient(app)

Expand All @@ -19,9 +21,10 @@ def test_read_main():
assert response.status_code == 200


# @pytest.mark.asyncio # TODO see above, mock bucket
def test_create_bucket():

response = client.post('create_bucket')
params = {'bucket_name': 'test_bucket'}
response = client.post('create_bucket', params=params)
assert response


Expand Down

0 comments on commit c4bb81d

Please sign in to comment.