diff --git a/README.md b/README.md index 1a2cf6bb..81d95150 100644 --- a/README.md +++ b/README.md @@ -104,8 +104,8 @@ The samples seen below are the _only_ code that you need to write! The framework activity.evaluate(state) # Assert - assert "https://example.com/jobs" == activity.type_properties["url"].value - assert "POST" == activity.type_properties["method"].value + assert "https://example.com/jobs" == activity.type_properties["url"].result + assert "POST" == activity.type_properties["method"].result body = activity.type_properties["body"].get_json_value() assert "123" == body["JobId"] assert "Job-123" == body["JobName"] @@ -129,19 +129,19 @@ The samples seen below are the _only_ code that you need to write! The framework assert set_variable_activity is not None assert "Set JobName" == set_variable_activity.name assert "JobName" == activity.type_properties["variableName"] - assert "Job-123" == activity.type_properties["value"].value + assert "Job-123" == activity.type_properties["value"].result get_version_activity = next(activities) assert get_version_activity is not None assert "Get version" == get_version_activity.name - assert "https://example.com/version" == get_version_activity.type_properties["url"].value + assert "https://example.com/version" == get_version_activity.type_properties["url"].result assert "GET" == get_version_activity.type_properties["method"] get_version_activity.set_result(DependencyCondition.Succeeded,{"Version": "version1"}) create_batch_activity = next(activities) assert create_batch_activity is not None assert "Trigger Azure Batch Job" == create_batch_activity.name - assert "https://example.com/jobs" == create_batch_activity.type_properties["url"].value + assert "https://example.com/jobs" == create_batch_activity.type_properties["url"].result assert "POST" == create_batch_activity.type_properties["method"] body = create_batch_activity.type_properties["body"].get_json_value() assert "123" == body["JobId"] diff --git a/examples/README.md b/examples/README.md index 4ffc0b88..983a0ab0 100644 --- a/examples/README.md +++ b/examples/README.md @@ -57,8 +57,8 @@ The samples seen below is the *only* code that you need to write! The framework activity.evaluate(state) # Assert - assert "https://example.com/jobs" == activity.type_properties["url"].value - assert "POST" == activity.type_properties["method"].value + assert "https://example.com/jobs" == activity.type_properties["url"].result + assert "POST" == activity.type_properties["method"].result body = activity.type_properties["body"].get_json_value() assert "123" == body["JobId"] assert "Job-123" == body["JobName"] @@ -82,19 +82,19 @@ The samples seen below is the *only* code that you need to write! The framework assert set_variable_activity is not None assert "Set JobName" == set_variable_activity.name assert "JobName" == activity.type_properties["variableName"] - assert "Job-123" == activity.type_properties["value"].value + assert "Job-123" == activity.type_properties["value"].result get_version_activity = next(activities) assert get_version_activity is not None assert "Get version" == get_version_activity.name - assert "https://example.com/version" == get_version_activity.type_properties["url"].value + assert "https://example.com/version" == get_version_activity.type_properties["url"].result assert "GET" == get_version_activity.type_properties["method"] get_version_activity.set_result(DependencyCondition.Succeeded,{"Version": "version1"}) create_batch_activity = next(activities) assert create_batch_activity is not None assert "Trigger Azure Batch Job" == create_batch_activity.name - assert "https://example.com/jobs" == create_batch_activity.type_properties["url"].value + assert "https://example.com/jobs" == create_batch_activity.type_properties["url"].result assert "POST" == create_batch_activity.type_properties["method"] body = create_batch_activity.type_properties["body"].get_json_value() assert "123" == body["JobId"] diff --git a/examples/data_factory/batch_job/test_data_factory_batchjob_functional.py b/examples/data_factory/batch_job/test_data_factory_batchjob_functional.py index 5a8ae8d7..4b4838fe 100644 --- a/examples/data_factory/batch_job/test_data_factory_batchjob_functional.py +++ b/examples/data_factory/batch_job/test_data_factory_batchjob_functional.py @@ -61,20 +61,20 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None: assert activity.name == "Set UserAssignedIdentityReference" assert activity.type_properties["variableName"] == "UserAssignedIdentityReference" assert ( - activity.type_properties["value"].value + activity.type_properties["value"].result == "/subscriptions/SUBSCRIPTION_ID/resourcegroups/RESOURCE_GROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-application-identity-name" # noqa: E501 ) activity = next(activities) assert activity.name == "Set ManagerApplicationPackagePath" assert activity.type_properties["variableName"] == "ManagerApplicationPackagePath" - assert activity.type_properties["value"].value == "$AZ_BATCH_APP_PACKAGE_batchmanager_2_0_0/batchmanager.tar.gz" + assert activity.type_properties["value"].result == "$AZ_BATCH_APP_PACKAGE_batchmanager_2_0_0/batchmanager.tar.gz" activity = next(activities) assert activity.name == "Set WorkloadApplicationPackagePath" assert activity.type_properties["variableName"] == "WorkloadApplicationPackagePath" assert ( - activity.type_properties["value"].value + activity.type_properties["value"].result == "$AZ_BATCH_APP_PACKAGE_test-application_1_5_0/test-application.tar.gz" ) @@ -82,7 +82,7 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None: assert activity.name == "Set CommonEnvironmentSettings" assert activity.type_properties["variableName"] == "CommonEnvironmentSettings" - common_environment_settings = activity.type_properties["value"].value + common_environment_settings = activity.type_properties["value"].result assert len(common_environment_settings) == 8 assert common_environment_settings[0]["name"] == "WORKLOAD_APP_PACKAGE" assert common_environment_settings[0]["value"] == "test-application" @@ -110,29 +110,29 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None: activity = next(activities) assert activity.name == "Set JobContainerName" assert activity.type_properties["variableName"] == "JobContainerName" - assert activity.type_properties["value"].value == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a" + assert activity.type_properties["value"].result == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a" activity = next(activities) assert activity.name == "Set Job Container URL" assert activity.type_properties["variableName"] == "JobContainerURL" assert ( - activity.type_properties["value"].value + activity.type_properties["value"].result == "https://batch-account-name.blob.core.windows.net/job-802100a5-ec79-4a52-be62-8d6109f3ff9a" ) activity = next(activities) assert activity.name == "Create Job Storage Container" assert ( - activity.type_properties["url"].value + activity.type_properties["url"].result == "https://batch-account-name.blob.core.windows.net/job-802100a5-ec79-4a52-be62-8d6109f3ff9a?restype=container" ) assert activity.type_properties["method"] == "PUT" - assert activity.type_properties["body"].value == "{}" + assert activity.type_properties["body"].result == "{}" activity = next(activities) assert activity.name == "Start Job" assert ( - activity.type_properties["url"].value + activity.type_properties["url"].result == "https://batch-account-name.westeurope.batch.azure.com/jobs?api-version=2022-10-01.16.0" ) assert activity.type_properties["method"] == "POST" @@ -192,29 +192,29 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None: assert activity.name == "Monitor Batch Job" assert activity.type_properties["pipeline"]["referenceName"] == "monitor_batch_job" assert len(activity.type_properties["parameters"]) == 1 - assert activity.type_properties["parameters"]["JobId"].value == "802100a5-ec79-4a52-be62-8d6109f3ff9a" + assert activity.type_properties["parameters"]["JobId"].result == "802100a5-ec79-4a52-be62-8d6109f3ff9a" activity = next(activities) assert activity.name == "Copy Output Files" assert activity.type_properties["pipeline"]["referenceName"] == "copy_output_files" assert len(activity.type_properties["parameters"]) == 5 assert ( - activity.type_properties["parameters"]["JobContainerName"].value == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a" + activity.type_properties["parameters"]["JobContainerName"].result == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a" ) - assert activity.type_properties["parameters"]["TaskOutputFolderPrefix"].value == "TASKOUTPUT_" + assert activity.type_properties["parameters"]["TaskOutputFolderPrefix"].result == "TASKOUTPUT_" assert ( - activity.type_properties["parameters"]["OutputStorageAccountName"].value + activity.type_properties["parameters"]["OutputStorageAccountName"].result == "test-application-output-storage-account-name" ) assert ( - activity.type_properties["parameters"]["OutputContainerName"].value == "test-application-output-container-name" + activity.type_properties["parameters"]["OutputContainerName"].result == "test-application-output-container-name" ) - assert activity.type_properties["parameters"]["OutputFolderName"].value == "TEMP" + assert activity.type_properties["parameters"]["OutputFolderName"].result == "TEMP" activity = next(activities) assert activity.name == "Delete Job Storage Container" assert ( - activity.type_properties["url"].value + activity.type_properties["url"].result == "https://batch-account-name.blob.core.windows.net/job-802100a5-ec79-4a52-be62-8d6109f3ff9a?restype=container" ) assert activity.type_properties["method"] == "DELETE" diff --git a/examples/data_factory/batch_job/test_data_factory_batchjob_unit.py b/examples/data_factory/batch_job/test_data_factory_batchjob_unit.py index 32185e9b..5c44ba3f 100644 --- a/examples/data_factory/batch_job/test_data_factory_batchjob_unit.py +++ b/examples/data_factory/batch_job/test_data_factory_batchjob_unit.py @@ -42,7 +42,7 @@ def test_set_job_container_url(test_framework: TestFramework, pipeline: Pipeline # Assert updated_variable = state.get_variable_by_name("JobContainerURL") expected_url = "https://batch-account-name.blob.core.windows.net/job-8b6b545b-c583-4a06-adf7-19ff41370aba" - assert activity.type_properties["value"].value == expected_url + assert activity.type_properties["value"].result == expected_url assert updated_variable.value == expected_url @@ -70,7 +70,7 @@ def test_set_user_assigned_identity_reference(test_framework: TestFramework, pip # Assert updated_variable = state.get_variable_by_name("UserAssignedIdentityReference") expected_reference = "/subscriptions/batch-account-subscription/resourcegroups/batch-account-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/workload-user-assigned-identity-name" - assert activity.type_properties["value"].value == expected_reference + assert activity.type_properties["value"].result == expected_reference assert updated_variable.value == expected_reference @@ -93,7 +93,7 @@ def test_set_manager_application_package_path(test_framework: TestFramework, pip # Assert updated_variable = state.get_variable_by_name("ManagerApplicationPackagePath") expected_path = "$AZ_BATCH_APP_PACKAGE_managerworkload_0_13_2/managerworkload.tar.gz" - assert activity.type_properties["value"].value == expected_path + assert activity.type_properties["value"].result == expected_path assert updated_variable.value == expected_path @@ -116,7 +116,7 @@ def test_set_workload_application_package_path(test_framework: TestFramework, pi # Assert updated_variable = state.get_variable_by_name("WorkloadApplicationPackagePath") expected_path = "$AZ_BATCH_APP_PACKAGE_workload_0_13_2/workload.tar.gz" - assert activity.type_properties["value"].value == expected_path + assert activity.type_properties["value"].result == expected_path assert updated_variable.value == expected_path @@ -155,7 +155,7 @@ def test_set_common_environment_settings(test_framework: TestFramework, pipeline activity.evaluate(state) # Assert - env_settings = activity.type_properties["value"].value + env_settings = activity.type_properties["value"].result assert env_settings[0]["name"] == "WORKLOAD_APP_PACKAGE" assert env_settings[0]["value"] == "workload" assert env_settings[1]["name"] == "WORKLOAD_APP_PACKAGE_VERSION" @@ -195,11 +195,11 @@ def test_create_job_storage_container(test_framework: TestFramework, pipeline: P # Assert assert activity.name == "Create Job Storage Container" assert ( - activity.type_properties["url"].value + activity.type_properties["url"].result == "https://batchstorage.blob.core.windows.net/job-8b6b545b-c583-4a06-adf7-19ff41370aba?restype=container" ) assert activity.type_properties["method"] == "PUT" - assert activity.type_properties["body"].value == "{}" + assert activity.type_properties["body"].result == "{}" def test_set_job_container_name(test_framework: TestFramework, pipeline: Pipeline) -> None: @@ -217,7 +217,7 @@ def test_set_job_container_name(test_framework: TestFramework, pipeline: Pipelin # Assert job_container_name_variable = state.get_variable_by_name("JobContainerName") - assert activity.type_properties["value"].value == "job-8b6b545b-c583-4a06-adf7-19ff41370aba" + assert activity.type_properties["value"].result == "job-8b6b545b-c583-4a06-adf7-19ff41370aba" assert job_container_name_variable.value == "job-8b6b545b-c583-4a06-adf7-19ff41370aba" @@ -293,7 +293,7 @@ def test_start_job_pipeline(test_framework: TestFramework, pipeline: Pipeline) - assert "Start Job" == activity.name assert ( "https://batch-account-name.westeurope.batch.azure.com/jobs?api-version=2022-10-01.16.0" - == activity.type_properties["url"].value + == activity.type_properties["url"].result ) assert "POST" == activity.type_properties["method"] @@ -361,7 +361,7 @@ def test_monitor_job(test_framework: TestFramework, pipeline: Pipeline) -> None: assert activity.name == "Monitor Batch Job" assert activity.type_properties["pipeline"]["referenceName"] == "monitor_batch_job" assert len(activity.type_properties["parameters"]) == 1 - assert activity.type_properties["parameters"]["JobId"].value == "8b6b545b-c583-4a06-adf7-19ff41370aba" + assert activity.type_properties["parameters"]["JobId"].result == "8b6b545b-c583-4a06-adf7-19ff41370aba" def test_copy_output_files(test_framework: TestFramework, pipeline: Pipeline) -> None: @@ -391,14 +391,14 @@ def test_copy_output_files(test_framework: TestFramework, pipeline: Pipeline) -> assert activity.type_properties["pipeline"]["referenceName"] == "copy_output_files" assert len(activity.type_properties["parameters"]) == 5 assert ( - activity.type_properties["parameters"]["JobContainerName"].value == "job-8b6b545b-c583-4a06-adf7-19ff41370aba" + activity.type_properties["parameters"]["JobContainerName"].result == "job-8b6b545b-c583-4a06-adf7-19ff41370aba" ) - assert activity.type_properties["parameters"]["TaskOutputFolderPrefix"].value == "TASKOUTPUT_" - assert activity.type_properties["parameters"]["OutputStorageAccountName"].value == "teststorage" + assert activity.type_properties["parameters"]["TaskOutputFolderPrefix"].result == "TASKOUTPUT_" + assert activity.type_properties["parameters"]["OutputStorageAccountName"].result == "teststorage" assert ( - activity.type_properties["parameters"]["OutputContainerName"].value == "test-application-output-container-name" + activity.type_properties["parameters"]["OutputContainerName"].result == "test-application-output-container-name" ) - assert activity.type_properties["parameters"]["OutputFolderName"].value == "output" + assert activity.type_properties["parameters"]["OutputFolderName"].result == "output" def test_delete_job_storage_container(test_framework: TestFramework, pipeline: Pipeline) -> None: @@ -419,7 +419,7 @@ def test_delete_job_storage_container(test_framework: TestFramework, pipeline: P # Assert assert activity.name == "Delete Job Storage Container" assert ( - activity.type_properties["url"].value + activity.type_properties["url"].result == "https://batchstorage.blob.core.windows.net/job-8b6b545b-c583-4a06-adf7-19ff41370aba?restype=container" ) assert activity.type_properties["method"] == "DELETE" diff --git a/examples/data_factory/copy_blobs/test_data_factory_copy_blobs_functional.py b/examples/data_factory/copy_blobs/test_data_factory_copy_blobs_functional.py index 535faf37..04bca92f 100644 --- a/examples/data_factory/copy_blobs/test_data_factory_copy_blobs_functional.py +++ b/examples/data_factory/copy_blobs/test_data_factory_copy_blobs_functional.py @@ -31,7 +31,7 @@ def test_copy_blobs_pipeline(request: pytest.FixtureRequest) -> None: list_folder_activity = next(activities) assert list_folder_activity.name == "List Folders" assert ( - list_folder_activity.type_properties["url"].value + list_folder_activity.type_properties["url"].result == "https://sourcestorageaccount.blob.core.windows.net/sourcecontainer?restype=container&comp=list&prefix=sourcefolder&delimiter=$SourceBlobDelimiter" ) assert list_folder_activity.type_properties["method"] == "GET" @@ -60,7 +60,7 @@ def test_copy_blobs_pipeline(request: pytest.FixtureRequest) -> None: assert copy_activity.name == "Copy files to Destination" assert copy_activity.type == "Copy" assert ( - copy_activity.type_properties["source"]["storeSettings"]["wildcardFolderPath"].value + copy_activity.type_properties["source"]["storeSettings"]["wildcardFolderPath"].result == "testfolder_1/$SourceBlobDelimiter" ) @@ -68,7 +68,7 @@ def test_copy_blobs_pipeline(request: pytest.FixtureRequest) -> None: assert copy_activity.name == "Copy files to Destination" assert copy_activity.type == "Copy" assert ( - copy_activity.type_properties["source"]["storeSettings"]["wildcardFolderPath"].value + copy_activity.type_properties["source"]["storeSettings"]["wildcardFolderPath"].result == "testfolder_2/$SourceBlobDelimiter" ) diff --git a/examples/data_factory/copy_blobs/test_data_factory_copy_blobs_unit.py b/examples/data_factory/copy_blobs/test_data_factory_copy_blobs_unit.py index 826d24b8..7b2bb7a0 100644 --- a/examples/data_factory/copy_blobs/test_data_factory_copy_blobs_unit.py +++ b/examples/data_factory/copy_blobs/test_data_factory_copy_blobs_unit.py @@ -46,7 +46,7 @@ def test_list_blobs(pipeline: Pipeline) -> None: # Assert assert activity.name == "List Folders" assert ( - activity.type_properties["url"].value + activity.type_properties["url"].result == "https://sourcestorage.blob.core.windows.net/container-8b6b545b-c583-4a06-adf7-19ff41370aba?restype=container&comp=list&prefix=testfolder&delimiter=$SourceBlobDelimiter" ) assert activity.type_properties["method"] == "GET" @@ -93,7 +93,7 @@ def test_for_each(pipeline: Pipeline) -> None: # Assert assert activity.name == "For Each SourceFolder" - assert activity.type_properties["items"].value == [ + assert activity.type_properties["items"].result == [ "testfolder_1/$SourceBlobDelimiter", "testfolder_2/$SourceBlobDelimiter", ] @@ -135,4 +135,4 @@ def test_copy_blobs_activity(pipeline: Pipeline, wildcardfolderpath: str) -> Non # Assert assert activity.name == "Copy files to Destination" - assert activity.type_properties["source"]["storeSettings"]["wildcardFolderPath"].value == wildcardfolderpath + assert activity.type_properties["source"]["storeSettings"]["wildcardFolderPath"].result == wildcardfolderpath diff --git a/examples/fabric/batch_job/test_fabric_batchjob_functional.py b/examples/fabric/batch_job/test_fabric_batchjob_functional.py index 30fd69ad..a540ffd6 100644 --- a/examples/fabric/batch_job/test_fabric_batchjob_functional.py +++ b/examples/fabric/batch_job/test_fabric_batchjob_functional.py @@ -61,20 +61,20 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None: assert activity.name == "Set UserAssignedIdentityReference" assert activity.type_properties["variableName"] == "UserAssignedIdentityReference" assert ( - activity.type_properties["value"].value + activity.type_properties["value"].result == "/subscriptions/SUBSCRIPTION_ID/resourcegroups/RESOURCE_GROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-application-identity-name" # noqa: E501 ) activity = next(activities) assert activity.name == "Set ManagerApplicationPackagePath" assert activity.type_properties["variableName"] == "ManagerApplicationPackagePath" - assert activity.type_properties["value"].value == "$AZ_BATCH_APP_PACKAGE_batchmanager_2_0_0/batchmanager.tar.gz" + assert activity.type_properties["value"].result == "$AZ_BATCH_APP_PACKAGE_batchmanager_2_0_0/batchmanager.tar.gz" activity = next(activities) assert activity.name == "Set WorkloadApplicationPackagePath" assert activity.type_properties["variableName"] == "WorkloadApplicationPackagePath" assert ( - activity.type_properties["value"].value + activity.type_properties["value"].result == "$AZ_BATCH_APP_PACKAGE_test-application_1_5_0/test-application.tar.gz" ) @@ -82,7 +82,7 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None: assert activity.name == "Set CommonEnvironmentSettings" assert activity.type_properties["variableName"] == "CommonEnvironmentSettings" - common_environment_settings = activity.type_properties["value"].value + common_environment_settings = activity.type_properties["value"].result assert len(common_environment_settings) == 8 assert common_environment_settings[0]["name"] == "WORKLOAD_APP_PACKAGE" assert common_environment_settings[0]["value"] == "test-application" @@ -110,24 +110,24 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None: activity = next(activities) assert activity.name == "Set JobContainerName" assert activity.type_properties["variableName"] == "JobContainerName" - assert activity.type_properties["value"].value == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a" + assert activity.type_properties["value"].result == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a" activity = next(activities) assert activity.name == "Set Job Container URL" assert activity.type_properties["variableName"] == "JobContainerURL" assert ( - activity.type_properties["value"].value + activity.type_properties["value"].result == "https://batch-account-name.blob.core.windows.net/job-802100a5-ec79-4a52-be62-8d6109f3ff9a" ) activity = next(activities) assert activity.name == "Create Job Storage Container" assert ( - activity.type_properties["relativeUrl"].value + activity.type_properties["relativeUrl"].result == "https://batch-account-name.blob.core.windows.net/job-802100a5-ec79-4a52-be62-8d6109f3ff9a?restype=container" ) assert activity.type_properties["method"] == "PUT" - assert activity.type_properties["body"].value == "{}" + assert activity.type_properties["body"].result == "{}" activity = next(activities) assert activity.name == "Start Job" @@ -189,28 +189,30 @@ def test_batch_job_pipeline(request: pytest.FixtureRequest) -> None: assert activity.name == "Monitor Batch Job" assert activity.type_properties["pipeline"]["referenceName"] == "4e66b9d6-d1b9-4d2b-9b89-4101def23c9a" assert len(activity.type_properties["parameters"]) == 1 - assert activity.type_properties["parameters"]["JobId"].value == "802100a5-ec79-4a52-be62-8d6109f3ff9a" + assert activity.type_properties["parameters"]["JobId"].result == "802100a5-ec79-4a52-be62-8d6109f3ff9a" activity = next(activities) assert activity.name == "Copy Output Files" assert activity.type_properties["pipeline"]["referenceName"] == "4e66b9d6-d1b9-4d2b-9b89-4101def23c9a" assert len(activity.type_properties["parameters"]) == 5 assert ( - activity.type_properties["parameters"]["JobContainerName"].value == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a" + activity.type_properties["parameters"]["JobContainerName"].result == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a" ) - assert activity.type_properties["parameters"]["TaskOutputFolderPrefix"].value == "TASKOUTPUT_" + assert activity.type_properties["parameters"]["TaskOutputFolderPrefix"].result == "TASKOUTPUT_" assert ( - activity.type_properties["parameters"]["OutputStorageAccountName"].value + activity.type_properties["parameters"]["OutputStorageAccountName"].result == "test-application-output-storage-account-name" ) assert ( - activity.type_properties["parameters"]["OutputContainerName"].value == "test-application-output-container-name" + activity.type_properties["parameters"]["OutputContainerName"].result == "test-application-output-container-name" ) - assert activity.type_properties["parameters"]["OutputFolderName"].value == "TEMP" + assert activity.type_properties["parameters"]["OutputFolderName"].result == "TEMP" activity = next(activities) assert activity.name == "Delete Job Storage Container" - assert activity.type_properties["relativeUrl"].value == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a?restype=container" + assert ( + activity.type_properties["relativeUrl"].result == "job-802100a5-ec79-4a52-be62-8d6109f3ff9a?restype=container" + ) assert activity.type_properties["method"] == "DELETE" assert "body" not in activity.type_properties diff --git a/examples/fabric/batch_job/test_fabric_batchjob_unit.py b/examples/fabric/batch_job/test_fabric_batchjob_unit.py index 1867b370..92736e3e 100644 --- a/examples/fabric/batch_job/test_fabric_batchjob_unit.py +++ b/examples/fabric/batch_job/test_fabric_batchjob_unit.py @@ -43,7 +43,7 @@ def test_set_job_container_url(test_framework: TestFramework, pipeline: Pipeline # Assert updated_variable = state.get_variable_by_name("JobContainerURL") expected_url = "https://batch-account-name.blob.core.windows.net/job-8b6b545b-c583-4a06-adf7-19ff41370aba" - assert expected_url == activity.type_properties["value"].value + assert expected_url == activity.type_properties["value"].result assert expected_url == updated_variable.value @@ -71,7 +71,7 @@ def test_set_user_assigned_identity_reference(test_framework: TestFramework, pip # Assert updated_variable = state.get_variable_by_name("UserAssignedIdentityReference") expected_reference = "/subscriptions/batch-account-subscription/resourcegroups/batch-account-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/workload-user-assigned-identity-name" - assert expected_reference == activity.type_properties["value"].value + assert expected_reference == activity.type_properties["value"].result assert expected_reference == updated_variable.value @@ -94,7 +94,7 @@ def test_set_manager_application_package_path(test_framework: TestFramework, pip # Assert updated_variable = state.get_variable_by_name("ManagerApplicationPackagePath") expected_path = "$AZ_BATCH_APP_PACKAGE_managerworkload_0_13_2/managerworkload.tar.gz" - assert expected_path == activity.type_properties["value"].value + assert expected_path == activity.type_properties["value"].result assert expected_path == updated_variable.value @@ -117,7 +117,7 @@ def test_set_workload_application_package_path(test_framework: TestFramework, pi # Assert updated_variable = state.get_variable_by_name("WorkloadApplicationPackagePath") expected_path = "$AZ_BATCH_APP_PACKAGE_workload_0_13_2/workload.tar.gz" - assert expected_path == activity.type_properties["value"].value + assert expected_path == activity.type_properties["value"].result assert expected_path == updated_variable.value @@ -156,7 +156,7 @@ def test_set_common_environment_settings(test_framework: TestFramework, pipeline activity.evaluate(state) # Assert - env_settings = activity.type_properties["value"].value + env_settings = activity.type_properties["value"].result assert env_settings[0]["name"] == "WORKLOAD_APP_PACKAGE" assert env_settings[0]["value"] == "workload" assert env_settings[1]["name"] == "WORKLOAD_APP_PACKAGE_VERSION" @@ -193,10 +193,10 @@ def test_create_job_storage_container(test_framework: TestFramework, pipeline: P # Assert assert "Create Job Storage Container" == activity.name assert ( - "/job-8b6b545b-c583-4a06-adf7-19ff41370aba?restype=container" == activity.type_properties["relativeUrl"].value + "/job-8b6b545b-c583-4a06-adf7-19ff41370aba?restype=container" == activity.type_properties["relativeUrl"].result ) assert "PUT" == activity.type_properties["method"] - assert "{}" == activity.type_properties["body"].value + assert "{}" == activity.type_properties["body"].result def test_set_job_container_name(test_framework: TestFramework, pipeline: Pipeline) -> None: @@ -214,7 +214,7 @@ def test_set_job_container_name(test_framework: TestFramework, pipeline: Pipelin # Assert job_container_name_variable = state.get_variable_by_name("JobContainerName") - assert "job-8b6b545b-c583-4a06-adf7-19ff41370aba" == activity.type_properties["value"].value + assert "job-8b6b545b-c583-4a06-adf7-19ff41370aba" == activity.type_properties["value"].result assert "job-8b6b545b-c583-4a06-adf7-19ff41370aba" == job_container_name_variable.value @@ -352,7 +352,7 @@ def test_monitor_job(test_framework: TestFramework, pipeline: Pipeline) -> None: assert "Monitor Batch Job" == activity.name assert "4e66b9d6-d1b9-4d2b-9b89-4101def23c9a" == activity.type_properties["pipeline"]["referenceName"] assert 1 == len(activity.type_properties["parameters"]) - assert "8b6b545b-c583-4a06-adf7-19ff41370aba" == activity.type_properties["parameters"]["JobId"].value + assert "8b6b545b-c583-4a06-adf7-19ff41370aba" == activity.type_properties["parameters"]["JobId"].result def test_copy_output_files(test_framework: TestFramework, pipeline: Pipeline) -> None: @@ -382,14 +382,14 @@ def test_copy_output_files(test_framework: TestFramework, pipeline: Pipeline) -> assert "4e66b9d6-d1b9-4d2b-9b89-4101def23c9a" == activity.type_properties["pipeline"]["referenceName"] assert 5 == len(activity.type_properties["parameters"]) assert ( - "job-8b6b545b-c583-4a06-adf7-19ff41370aba" == activity.type_properties["parameters"]["JobContainerName"].value + "job-8b6b545b-c583-4a06-adf7-19ff41370aba" == activity.type_properties["parameters"]["JobContainerName"].result ) - assert "TASKOUTPUT_" == activity.type_properties["parameters"]["TaskOutputFolderPrefix"].value - assert "teststorage" == activity.type_properties["parameters"]["OutputStorageAccountName"].value + assert "TASKOUTPUT_" == activity.type_properties["parameters"]["TaskOutputFolderPrefix"].result + assert "teststorage" == activity.type_properties["parameters"]["OutputStorageAccountName"].result assert ( - "test-application-output-container-name" == activity.type_properties["parameters"]["OutputContainerName"].value + "test-application-output-container-name" == activity.type_properties["parameters"]["OutputContainerName"].result ) - assert "output" == activity.type_properties["parameters"]["OutputFolderName"].value + assert "output" == activity.type_properties["parameters"]["OutputFolderName"].result def test_delete_job_storage_container(test_framework: TestFramework, pipeline: Pipeline) -> None: @@ -410,6 +410,6 @@ def test_delete_job_storage_container(test_framework: TestFramework, pipeline: P # Assert assert "Delete Job Storage Container" == activity.name assert ( - "/job-8b6b545b-c583-4a06-adf7-19ff41370aba?restype=container" == activity.type_properties["relativeUrl"].value + "/job-8b6b545b-c583-4a06-adf7-19ff41370aba?restype=container" == activity.type_properties["relativeUrl"].result ) assert "DELETE" == activity.type_properties["method"] diff --git a/src/data_factory_testing_framework/__init__.py b/src/data_factory_testing_framework/__init__.py index e69de29b..7fde6ab9 100644 --- a/src/data_factory_testing_framework/__init__.py +++ b/src/data_factory_testing_framework/__init__.py @@ -0,0 +1,3 @@ +__all__ = [ + "test_framework", +] diff --git a/src/data_factory_testing_framework/models/__init__.py b/src/data_factory_testing_framework/models/__init__.py index e69de29b..92eca7ba 100644 --- a/src/data_factory_testing_framework/models/__init__.py +++ b/src/data_factory_testing_framework/models/__init__.py @@ -0,0 +1,31 @@ +from data_factory_testing_framework.models.activities.activity import Activity +from data_factory_testing_framework.models.activities.activity_dependency import ActivityDependency +from data_factory_testing_framework.models.activities.append_variable_activity import AppendVariableActivity +from data_factory_testing_framework.models.activities.control_activity import ControlActivity +from data_factory_testing_framework.models.activities.execute_pipeline_activity import ExecutePipelineActivity +from data_factory_testing_framework.models.activities.fail_activity import FailActivity +from data_factory_testing_framework.models.activities.filter_activity import FilterActivity +from data_factory_testing_framework.models.activities.for_each_activity import ForEachActivity +from data_factory_testing_framework.models.activities.if_condition_activity import IfConditionActivity +from data_factory_testing_framework.models.activities.set_variable_activity import SetVariableActivity +from data_factory_testing_framework.models.activities.switch_activity import SwitchActivity +from data_factory_testing_framework.models.activities.until_activity import UntilActivity +from data_factory_testing_framework.models.data_factory_element import DataFactoryElement +from data_factory_testing_framework.models.pipeline import Pipeline + +__all__ = [ + "Activity", + "ActivityDependency", + "AppendVariableActivity", + "ControlActivity", + "ExecutePipelineActivity", + "FailActivity", + "FilterActivity", + "ForEachActivity", + "IfConditionActivity", + "SetVariableActivity", + "SwitchActivity", + "UntilActivity", + "DataFactoryElement", + "Pipeline", +] diff --git a/src/data_factory_testing_framework/models/activities/execute_pipeline_activity.py b/src/data_factory_testing_framework/models/activities/execute_pipeline_activity.py index 3d851ac4..f10eddce 100644 --- a/src/data_factory_testing_framework/models/activities/execute_pipeline_activity.py +++ b/src/data_factory_testing_framework/models/activities/execute_pipeline_activity.py @@ -31,7 +31,7 @@ def get_child_run_parameters(self, state: PipelineRunState) -> List[RunParameter for parameter_name, parameter_value in self.parameters.items(): parameter_value = ( - parameter_value.value if isinstance(parameter_value, DataFactoryElement) else parameter_value + parameter_value.result if isinstance(parameter_value, DataFactoryElement) else parameter_value ) child_parameters.append(RunParameter(RunParameterType.Pipeline, parameter_name, parameter_value)) diff --git a/src/data_factory_testing_framework/models/activities/for_each_activity.py b/src/data_factory_testing_framework/models/activities/for_each_activity.py index 8e7575bf..fe3c00ac 100644 --- a/src/data_factory_testing_framework/models/activities/for_each_activity.py +++ b/src/data_factory_testing_framework/models/activities/for_each_activity.py @@ -37,7 +37,7 @@ def evaluate_control_activities( state: PipelineRunState, evaluate_activities: Callable[[List[Activity], PipelineRunState], Iterator[Activity]], ) -> Iterator[Activity]: - for item in self.items.value: + for item in self.items.result: scoped_state = state.create_iteration_scope(item) for activity in evaluate_activities(self.activities, scoped_state): yield activity diff --git a/src/data_factory_testing_framework/models/activities/if_condition_activity.py b/src/data_factory_testing_framework/models/activities/if_condition_activity.py index 00ae809e..8ffe4452 100644 --- a/src/data_factory_testing_framework/models/activities/if_condition_activity.py +++ b/src/data_factory_testing_framework/models/activities/if_condition_activity.py @@ -41,7 +41,7 @@ def evaluate_control_activities( evaluate_activities: Callable[[List[Activity], PipelineRunState], Iterator[Activity]], ) -> Iterator[Activity]: scoped_state = state.create_iteration_scope(None) - activities = self.if_true_activities if self.expression.value else self.if_false_activities + activities = self.if_true_activities if self.expression.result else self.if_false_activities for activity in evaluate_activities(activities, scoped_state): yield activity diff --git a/src/data_factory_testing_framework/models/activities/switch_activity.py b/src/data_factory_testing_framework/models/activities/switch_activity.py index 45f4ddc4..a45312d8 100644 --- a/src/data_factory_testing_framework/models/activities/switch_activity.py +++ b/src/data_factory_testing_framework/models/activities/switch_activity.py @@ -41,7 +41,7 @@ def evaluate_control_activities( evaluate_activities: Callable[[List[Activity], PipelineRunState], Iterator[Activity]], ) -> Iterator[Activity]: for case, activities in self.cases_activities.items(): - if case == self.on.value: + if case == self.on.result: return self._run_activities_in_scope(state, activities, evaluate_activities) return self._run_activities_in_scope(state, self.default_activities, evaluate_activities) diff --git a/src/data_factory_testing_framework/models/data_factory_element.py b/src/data_factory_testing_framework/models/data_factory_element.py index 9429b5cb..4d07faaa 100644 --- a/src/data_factory_testing_framework/models/data_factory_element.py +++ b/src/data_factory_testing_framework/models/data_factory_element.py @@ -9,7 +9,7 @@ class DataFactoryElement(Generic[T]): expression: str - value: T + result: T def __init__(self, expression: str) -> None: """DataFactoryElement. @@ -18,17 +18,17 @@ def __init__(self, expression: str) -> None: expression: Expression to evaluate. (e.g. @concat(@pipeline().parameters.pipelineName, '-pipeline')) """ self.expression = expression - self.value: Union[str, int, bool, float] = None + self.result: Union[str, int, bool, float] = None def evaluate(self, state: RunState) -> Union[str, int, bool, float]: """Evaluate the expression.""" evaluator = ExpressionEvaluator() - self.value = evaluator.evaluate(self.expression, state) - return self.value + self.result = evaluator.evaluate(self.expression, state) + return self.result def get_json_value(self) -> Any: # noqa: ANN401 """Loads the value as a json object.""" - if self.value: - return json.loads(self.value) + if self.result: + return json.loads(self.result) return None diff --git a/src/data_factory_testing_framework/state/__init__.py b/src/data_factory_testing_framework/state/__init__.py index 882d09af..63b568d6 100644 --- a/src/data_factory_testing_framework/state/__init__.py +++ b/src/data_factory_testing_framework/state/__init__.py @@ -1,3 +1,4 @@ +from .dependency_condition import DependencyCondition from .pipeline_run_state import PipelineRunState from .pipeline_run_variable import PipelineRunVariable from .run_parameter import RunParameter @@ -5,9 +6,10 @@ from .run_state import RunState __all__ = [ + "DependencyCondition", "PipelineRunState", + "PipelineRunVariable", "RunParameter", "RunParameterType", "RunState", - "PipelineRunVariable", ] diff --git a/tests/functional/activity_outputs/test_set_activity_output.py b/tests/functional/activity_outputs/test_set_activity_output.py index 115334ac..4bce7f0a 100644 --- a/tests/functional/activity_outputs/test_set_activity_output.py +++ b/tests/functional/activity_outputs/test_set_activity_output.py @@ -33,7 +33,7 @@ def test_execute_pipeline_activity_child_activities_executed(request: pytest.Fix assert activity.name == "SetVersion" assert activity.type == "SetVariable" assert activity.type_properties["variableName"] == "version" - assert activity.type_properties["value"].value == "1.2.3" + assert activity.type_properties["value"].result == "1.2.3" with pytest.raises(StopIteration): next(activities) diff --git a/tests/functional/append_variable_pipeline/test_append_variable_activity_pipeline.py b/tests/functional/append_variable_pipeline/test_append_variable_activity_pipeline.py index 9b61002c..84d05e62 100644 --- a/tests/functional/append_variable_pipeline/test_append_variable_activity_pipeline.py +++ b/tests/functional/append_variable_pipeline/test_append_variable_activity_pipeline.py @@ -38,8 +38,8 @@ def test_append_variable_activity( # Assert activity: SetVariableActivity = next(activities) assert activity.type == "SetVariable" - assert activity.value.value == initial_value + assert activity.value.result == initial_value activity: AppendVariableActivity = next(activities) assert activity.type == "AppendVariable" - assert activity.value.value == appended_value + assert activity.value.result == appended_value diff --git a/tests/functional/execute_child_pipeline/test_execute_pipeline_activity.py b/tests/functional/execute_child_pipeline/test_execute_pipeline_activity.py index 3ef6ef46..f7d55f91 100644 --- a/tests/functional/execute_child_pipeline/test_execute_pipeline_activity.py +++ b/tests/functional/execute_child_pipeline/test_execute_pipeline_activity.py @@ -26,8 +26,8 @@ def test_execute_pipeline_activity_child_activities_executed(request: pytest.Fix # Assert assert child_web_activity is not None assert child_web_activity.name == "API Call" - assert child_web_activity.type_properties["url"].value == "https://example.com" - assert child_web_activity.type_properties["body"].value == '{ "key": "value" }' + assert child_web_activity.type_properties["url"].result == "https://example.com" + assert child_web_activity.type_properties["body"].result == '{ "key": "value" }' with pytest.raises(StopIteration): next(activities) diff --git a/tests/functional/filter_activity_pipeline/test_filter_activity_pipeline.py b/tests/functional/filter_activity_pipeline/test_filter_activity_pipeline.py index 4ad374fb..ce022ce9 100644 --- a/tests/functional/filter_activity_pipeline/test_filter_activity_pipeline.py +++ b/tests/functional/filter_activity_pipeline/test_filter_activity_pipeline.py @@ -36,9 +36,9 @@ def test_filter_activity(input_values: [], expected_filtered_values: [], request # Assert activity: FilterActivity = next(activities) assert activity.type == "Filter" - assert activity.items.value == input_values + assert activity.items.result == input_values assert activity.output["value"] == expected_filtered_values activity: Activity = next(activities) assert activity.type == "SetVariable" - assert activity.type_properties["value"].value == expected_filtered_values + assert activity.type_properties["value"].result == expected_filtered_values diff --git a/tests/test_test_framework.py b/tests/test_test_framework.py index 723bc1e1..f0756287 100644 --- a/tests/test_test_framework.py +++ b/tests/test_test_framework.py @@ -103,7 +103,7 @@ def test_fail_activity_halts_further_evaluation() -> None: assert activity.name == "failActivity" assert activity.type == "Fail" assert activity.status == "Failed" - assert activity.type_properties["message"].value == "Error code: 500" + assert activity.type_properties["message"].result == "Error code: 500" assert activity.type_properties["errorCode"] == "500" # Assert that there are no more activities diff --git a/tests/unit/models/activities/base/test_activity.py b/tests/unit/models/activities/base/test_activity.py index 07cd0dce..f64f2e96 100644 --- a/tests/unit/models/activities/base/test_activity.py +++ b/tests/unit/models/activities/base/test_activity.py @@ -107,4 +107,4 @@ def test_evaluate_is_evaluating_expressions_inside_dict() -> None: pipeline_activity.evaluate(state) # Assert - assert pipeline_activity.type_properties["parameters"]["url"].value == "example.com" + assert pipeline_activity.type_properties["parameters"]["url"].result == "example.com" diff --git a/tests/unit/models/activities/control_activities/test_filter_activity.py b/tests/unit/models/activities/control_activities/test_filter_activity.py index da6c705f..e76b7735 100644 --- a/tests/unit/models/activities/control_activities/test_filter_activity.py +++ b/tests/unit/models/activities/control_activities/test_filter_activity.py @@ -51,5 +51,5 @@ def test_filter_activity_on_range_of_values(input_values: [], expected_filtered_ # Assert activity = next(activities) assert activity.type == "Filter" - assert activity.type_properties["items"].value == input_values + assert activity.type_properties["items"].result == input_values assert activity.output["value"] == expected_filtered_values diff --git a/tests/unit/models/activities/control_activities/test_for_each_activity.py b/tests/unit/models/activities/control_activities/test_for_each_activity.py index 8efe0bc3..fa730c27 100644 --- a/tests/unit/models/activities/control_activities/test_for_each_activity.py +++ b/tests/unit/models/activities/control_activities/test_for_each_activity.py @@ -39,17 +39,17 @@ def test_when_evaluate_child_activities_then_should_return_the_activity_with_ite set_variable_activity: SetVariableActivity = next(activities) assert set_variable_activity is not None assert set_variable_activity.name == "setVariable" - assert set_variable_activity.type_properties["value"].value == "a" + assert set_variable_activity.type_properties["value"].result == "a" set_variable_activity = next(activities) assert set_variable_activity is not None assert set_variable_activity.name == "setVariable" - assert set_variable_activity.type_properties["value"].value == "b" + assert set_variable_activity.type_properties["value"].result == "b" set_variable_activity = next(activities) assert set_variable_activity is not None assert set_variable_activity.name == "setVariable" - assert set_variable_activity.type_properties["value"].value == "c" + assert set_variable_activity.type_properties["value"].result == "c" # Assert that there are no more activities with pytest.raises(StopIteration): diff --git a/tests/unit/models/activities/control_activities/test_if_condition_activity.py b/tests/unit/models/activities/control_activities/test_if_condition_activity.py index ee8570ef..0cf51dd3 100644 --- a/tests/unit/models/activities/control_activities/test_if_condition_activity.py +++ b/tests/unit/models/activities/control_activities/test_if_condition_activity.py @@ -19,7 +19,7 @@ def test_when_evaluated_should_evaluate_expression() -> None: activity.evaluate(PipelineRunState()) # Assert - assert activity.expression.value + assert activity.expression.result @pytest.mark.parametrize( diff --git a/tests/unit/models/activities/control_activities/test_switch_activity.py b/tests/unit/models/activities/control_activities/test_switch_activity.py index 05713491..c83f6c6e 100644 --- a/tests/unit/models/activities/control_activities/test_switch_activity.py +++ b/tests/unit/models/activities/control_activities/test_switch_activity.py @@ -20,7 +20,7 @@ def test_when_evaluated_should_evaluate_expression() -> None: activity.evaluate(PipelineRunState()) # Assert - assert activity.on.value == "case_1" + assert activity.on.result == "case_1" @pytest.mark.parametrize( diff --git a/tests/unit/models/activities/test_execute_pipeline_activity_parameters.py b/tests/unit/models/activities/test_execute_pipeline_activity_parameters.py index 4976c331..b7b046e0 100644 --- a/tests/unit/models/activities/test_execute_pipeline_activity_parameters.py +++ b/tests/unit/models/activities/test_execute_pipeline_activity_parameters.py @@ -26,7 +26,7 @@ def test_execute_pipeline_activity_evaluates_parameters() -> None: # Assert assert activity is not None assert activity.name == "ExecutePipelineActivity" - assert activity.parameters["url"].value == "value1" + assert activity.parameters["url"].result == "value1" def test_execute_pipeline_activity_evaluates_no_parameters() -> None: diff --git a/tests/unit/models/activities/test_fail_activity.py b/tests/unit/models/activities/test_fail_activity.py index 15d38a99..548c76fc 100644 --- a/tests/unit/models/activities/test_fail_activity.py +++ b/tests/unit/models/activities/test_fail_activity.py @@ -24,5 +24,5 @@ def test_fail_activity_evaluates_to_failed_result() -> None: assert activity is not None assert activity.name == "FailActivity" assert activity.status == DependencyCondition.FAILED - assert activity.type_properties["message"].value == "Error code: 500" + assert activity.type_properties["message"].result == "Error code: 500" assert activity.type_properties["errorCode"] == "500"