Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create a titiler-sentinel instance in fixtures to be used in tests #80

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vincentsarago
Copy link
Collaborator

This PR replace the hardcoded URL by a internal fixture which will run titiler_sentinel in background.

The Tiler is patched and should not fetch any external files

cc @rbavery

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") # use token authentication


def api_key_auth(api_key: str = Depends(oauth2_scheme)):
"""api key auth dependency"""
api_keys = [os.getenv("API_KEY")]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this in the function to help with tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could maybe revert and patch the variable in tests

@@ -42,6 +41,8 @@
from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers
from titiler.core.factory import MultiBandTilerFactory

from cerulean_cloud.auth import api_key_auth
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use absolute path

S1_METADATA = f.read()


class Server(uvicorn.Server):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async def titiler_application():
"""Run app in Thread."""
with patch("rio_tiler.io.cogeo.rasterio") as rio:
with patch("rio_tiler_pds.sentinel.aws.sentinel1.get_object") as s1meta:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we patch both rio-tiler and rio-tiler-pds to make sure we don't reach AWS resources

]
]
]
"id" : "S1A_IW_GRDH_1SDV_20201121T225759_20201121T225828_035353_04216C_62EA",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh No I didn't see one already existed 🤦

@rbavery
Copy link
Collaborator

rbavery commented Apr 13, 2023

The test is currently failing because a string is tryping to be combined with an asyncio object

(<async_generator obj...2aeffb9d0>, 'tiles/WorldCRS84Quad/9/300/153')

working on a fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants