Skip to content

Commit

Permalink
Add in some mock layers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaraphael committed Aug 3, 2023
1 parent d5a69d0 commit adf59c6
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions test/test_cerulean_cloud/test_inference_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
from datetime import datetime
from unittest.mock import patch
from unittest.mock import Mock, patch

import numpy as np
import pytest
Expand All @@ -23,6 +23,13 @@
from cerulean_cloud.titiler_client import TitilerClient


def get_mock_layer(short_name, source_url):
mock_layer = Mock()
mock_layer.short_name = short_name
mock_layer.source_url = source_url
return mock_layer


async def mock_get_base_tile(self, sceneid, tile, scale, rescale):
with rasterio.open("test/test_cerulean_cloud/fixtures/example_tile.png") as src:
img_array = reshape_as_image(src.read())
Expand Down Expand Up @@ -165,8 +172,11 @@ def test_get_dist_array():
def test_handle_aux_datasets(httpx_mock):
ar_mem_file = handle_aux_datasets(
[
"test/test_cerulean_cloud/fixtures/test_cogeo.tiff",
"test/test_cerulean_cloud/fixtures/test_cogeo.tiff",
get_mock_layer("VV", ""),
get_mock_layer("VESSEL", ""),
get_mock_layer(
"INFRA", "test/test_cerulean_cloud/fixtures/test_cogeo.tiff"
),
],
scene_id="S1A_IW_GRDH_1SDV_20200802T141646_20200802T141711_033729_03E8C7_E4F5",
bounds=[
Expand All @@ -189,8 +199,11 @@ def test_handle_aux_datasets(httpx_mock):

ar_mem_file = handle_aux_datasets(
[
"ship_density",
"test/test_cerulean_cloud/fixtures/test_cogeo.tiff",
get_mock_layer("VV", ""),
get_mock_layer("VESSEL", ""),
get_mock_layer(
"INFRA", "test/test_cerulean_cloud/fixtures/test_cogeo.tiff"
),
],
scene_id="S1A_IW_GRDH_1SDV_20200802T141646_20200802T141711_033729_03E8C7_E4F5",
bounds=[
Expand Down

0 comments on commit adf59c6

Please sign in to comment.