diff --git a/package/kedro_viz/api/rest/requests.py b/package/kedro_viz/api/rest/requests.py index a6ce949d3d..e499188b29 100644 --- a/package/kedro_viz/api/rest/requests.py +++ b/package/kedro_viz/api/rest/requests.py @@ -7,6 +7,6 @@ class DeployerConfiguration(BaseModel): """Credentials for Deployers.""" platform: str - is_datasets_previewed: bool + are_datasets_previewable: bool = False endpoint: str bucket_name: str diff --git a/package/kedro_viz/api/rest/router.py b/package/kedro_viz/api/rest/router.py index c72003eb60..c21fa8b81f 100644 --- a/package/kedro_viz/api/rest/router.py +++ b/package/kedro_viz/api/rest/router.py @@ -63,7 +63,7 @@ async def deploy_kedro_viz(input_values: DeployerConfiguration): deployer = DeployerFactory.create_deployer( input_values.platform, input_values.endpoint, input_values.bucket_name ) - deployer.deploy(input_values.is_datasets_previewed) + deployer.deploy(input_values.are_datasets_previewable) response = { "message": "Website deployed on " f"{input_values.platform and input_values.platform.upper()}", diff --git a/package/tests/test_api/test_rest/test_router.py b/package/tests/test_api/test_rest/test_router.py index 9b5c28cc18..ae83ca23a0 100644 --- a/package/tests/test_api/test_rest/test_router.py +++ b/package/tests/test_api/test_rest/test_router.py @@ -6,25 +6,32 @@ class MockDeployer: def __init__(self, platform, endpoint, bucket_name): pass - def deploy(self): + def deploy(self, are_datasets_previewable): pass @pytest.mark.parametrize( - "platform, endpoint, bucket_name", + "platform, endpoint, bucket_name, are_datasets_previewable", [ - ("aws", "http://mocked-url.com", "s3://shareableviz"), - ("azure", "http://mocked-url.com", "abfs://shareableviz"), + ("aws", "http://mocked-url.com", "s3://shareableviz", True), + ("azure", "http://mocked-url.com", "abfs://shareableviz", False), ], ) -def test_deploy_kedro_viz(client, platform, endpoint, bucket_name, mocker): +def test_deploy_kedro_viz( + client, platform, endpoint, bucket_name, are_datasets_previewable, mocker +): mocker.patch( "kedro_viz.api.rest.router.DeployerFactory.create_deployer", return_value=MockDeployer(platform, endpoint, bucket_name), ) response = client.post( "/api/deploy", - json={"platform": platform, "endpoint": endpoint, "bucket_name": bucket_name}, + json={ + "platform": platform, + "endpoint": endpoint, + "bucket_name": bucket_name, + "are_datasets_previewable": are_datasets_previewable, + }, ) assert response.status_code == 200