|
10 | 10 | import requests |
11 | 11 |
|
12 | 12 | from datacustomcode.credentials import Credentials |
13 | | -from datacustomcode.deploy import ( |
14 | | - AccessTokenResponse, |
15 | | - CreateDeploymentResponse, |
16 | | - DataTransformConfig, |
17 | | - DeploymentsResponse, |
18 | | - TransformationJobMetadata, |
19 | | - _make_api_call, |
20 | | - _retrieve_access_token, |
21 | | - create_data_transform, |
22 | | - create_data_transform_config, |
23 | | - create_deployment, |
24 | | - deploy_full, |
25 | | - get_data_transform_config, |
26 | | - get_deployments, |
27 | | - run_data_transform, |
28 | | - wait_for_deployment, |
29 | | - zip_and_upload_directory, |
30 | | -) |
| 13 | + |
| 14 | +# Patch get_version before importing deploy module |
| 15 | +with patch("datacustomcode.version.get_version", return_value="1.2.3"): |
| 16 | + from datacustomcode.deploy import ( |
| 17 | + AccessTokenResponse, |
| 18 | + CreateDeploymentResponse, |
| 19 | + DataTransformConfig, |
| 20 | + DeploymentsResponse, |
| 21 | + TransformationJobMetadata, |
| 22 | + _make_api_call, |
| 23 | + _retrieve_access_token, |
| 24 | + create_data_transform, |
| 25 | + create_data_transform_config, |
| 26 | + create_deployment, |
| 27 | + deploy_full, |
| 28 | + get_data_transform_config, |
| 29 | + get_deployments, |
| 30 | + run_data_transform, |
| 31 | + wait_for_deployment, |
| 32 | + zip_and_upload_directory, |
| 33 | + ) |
31 | 34 |
|
32 | 35 |
|
33 | 36 | class TestMakeApiCall: |
@@ -248,10 +251,14 @@ def test_create_data_transform_config( |
248 | 251 | mock_get_config.assert_called_once_with("/test/dir") |
249 | 252 | mock_file.assert_called_once_with("/test/dir/config.json", "w") |
250 | 253 | mock_json_dump.assert_called_once() |
251 | | - # Check permissions in config |
252 | | - config = mock_json_dump.call_args[0][0] |
253 | | - assert config["permissions"]["read"]["dlo"] == "input_dlo" |
254 | | - assert config["permissions"]["write"]["dlo"] == "output_dlo" |
| 254 | + |
| 255 | + # Verify the config contains all required fields including sdkVersion |
| 256 | + config_data = mock_json_dump.call_args[0][0] |
| 257 | + assert config_data["entryPoint"] == "entrypoint.py" |
| 258 | + assert config_data["dataspace"] == "default" |
| 259 | + assert config_data["permissions"]["read"]["dlo"] == "input_dlo" |
| 260 | + assert config_data["permissions"]["write"]["dlo"] == "output_dlo" |
| 261 | + assert config_data["sdkVersion"] == "1.2.3" |
255 | 262 |
|
256 | 263 |
|
257 | 264 | class TestCreateDataTransform: |
|
0 commit comments