From 823803fd83b85ac69c239396bbcb52f685c8b3ae Mon Sep 17 00:00:00 2001 From: devsjc <47188100+devsjc@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:11:02 +0000 Subject: [PATCH] fix(integration): Fix test --- src/test_integration/test_integration.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/test_integration/test_integration.py b/src/test_integration/test_integration.py index a60e2ec5..5119401e 100644 --- a/src/test_integration/test_integration.py +++ b/src/test_integration/test_integration.py @@ -3,26 +3,27 @@ import xarray as xr from returns.pipeline import is_successful +from returns.result import ResultE -from nwp_consumer.internal import handlers, repositories, services +from nwp_consumer.internal import repositories, services class TestIntegration(unittest.TestCase): def test_ceda_metoffice_global_model(self) -> None: - c = handlers.CLIHandler( - consumer_usecase=services.ConsumerService( - model_repository=repositories.model_repositories.CEDAFTPModelRepository, - notification_repository=repositories.notification_repositories.StdoutNotificationRepository, - ), - archiver_usecase=services.ArchiverService( - model_repository=repositories.model_repositories.CEDAFTPModelRepository, - notification_repository=repositories.notification_repositories.StdoutNotificationRepository, - ), + test_it =dt.datetime(2021, 1, 1, tzinfo=dt.UTC) + service_result = services.ConsumerService.from_adaptors( + model_adaptor=repositories.model_repositories.CEDAFTPModelRepository, + notification_adaptor=repositories.notification_repositories.StdoutNotificationRepository, + ) + result: ResultE[str] = service_result.do( + consume_result + for service in service_result + for consume_result in service.consume(period=test_it) ) - result = c._consumer_usecase.consume(it=dt.datetime(2021, 1, 1, tzinfo=dt.UTC)) self.assertTrue(is_successful(result), msg=f"{result}") da = xr.open_dataarray(result.unwrap(), engine="zarr") self.assertTrue(da.sizes["init_time"] > 0) +