cumulusci-plus 5.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cumulusci-plus might be problematic. Click here for more details.
- cumulusci/__about__.py +1 -0
- cumulusci/__init__.py +22 -0
- cumulusci/__main__.py +3 -0
- cumulusci/cli/__init__.py +0 -0
- cumulusci/cli/cci.py +244 -0
- cumulusci/cli/error.py +125 -0
- cumulusci/cli/flow.py +185 -0
- cumulusci/cli/logger.py +72 -0
- cumulusci/cli/org.py +692 -0
- cumulusci/cli/plan.py +181 -0
- cumulusci/cli/project.py +391 -0
- cumulusci/cli/robot.py +116 -0
- cumulusci/cli/runtime.py +190 -0
- cumulusci/cli/service.py +521 -0
- cumulusci/cli/task.py +295 -0
- cumulusci/cli/tests/__init__.py +0 -0
- cumulusci/cli/tests/test_cci.py +545 -0
- cumulusci/cli/tests/test_error.py +170 -0
- cumulusci/cli/tests/test_flow.py +276 -0
- cumulusci/cli/tests/test_logger.py +25 -0
- cumulusci/cli/tests/test_org.py +1438 -0
- cumulusci/cli/tests/test_plan.py +245 -0
- cumulusci/cli/tests/test_project.py +235 -0
- cumulusci/cli/tests/test_robot.py +177 -0
- cumulusci/cli/tests/test_runtime.py +197 -0
- cumulusci/cli/tests/test_service.py +853 -0
- cumulusci/cli/tests/test_task.py +266 -0
- cumulusci/cli/tests/test_ui.py +310 -0
- cumulusci/cli/tests/test_utils.py +122 -0
- cumulusci/cli/tests/utils.py +52 -0
- cumulusci/cli/ui.py +234 -0
- cumulusci/cli/utils.py +150 -0
- cumulusci/conftest.py +181 -0
- cumulusci/core/__init__.py +0 -0
- cumulusci/core/config/BaseConfig.py +5 -0
- cumulusci/core/config/BaseTaskFlowConfig.py +5 -0
- cumulusci/core/config/OrgConfig.py +5 -0
- cumulusci/core/config/ScratchOrgConfig.py +5 -0
- cumulusci/core/config/__init__.py +125 -0
- cumulusci/core/config/base_config.py +111 -0
- cumulusci/core/config/base_task_flow_config.py +82 -0
- cumulusci/core/config/marketing_cloud_service_config.py +83 -0
- cumulusci/core/config/oauth2_service_config.py +17 -0
- cumulusci/core/config/org_config.py +604 -0
- cumulusci/core/config/project_config.py +782 -0
- cumulusci/core/config/scratch_org_config.py +251 -0
- cumulusci/core/config/sfdx_org_config.py +220 -0
- cumulusci/core/config/tests/_test_config_backwards_compatibility.py +33 -0
- cumulusci/core/config/tests/test_config.py +1895 -0
- cumulusci/core/config/tests/test_config_expensive.py +839 -0
- cumulusci/core/config/tests/test_config_util.py +91 -0
- cumulusci/core/config/universal_config.py +88 -0
- cumulusci/core/config/util.py +18 -0
- cumulusci/core/datasets.py +303 -0
- cumulusci/core/debug.py +33 -0
- cumulusci/core/dependencies/__init__.py +55 -0
- cumulusci/core/dependencies/base.py +561 -0
- cumulusci/core/dependencies/dependencies.py +273 -0
- cumulusci/core/dependencies/github.py +177 -0
- cumulusci/core/dependencies/github_resolvers.py +244 -0
- cumulusci/core/dependencies/resolvers.py +580 -0
- cumulusci/core/dependencies/tests/__init__.py +0 -0
- cumulusci/core/dependencies/tests/conftest.py +385 -0
- cumulusci/core/dependencies/tests/test_dependencies.py +950 -0
- cumulusci/core/dependencies/tests/test_github.py +83 -0
- cumulusci/core/dependencies/tests/test_resolvers.py +1027 -0
- cumulusci/core/dependencies/utils.py +13 -0
- cumulusci/core/enums.py +11 -0
- cumulusci/core/exceptions.py +311 -0
- cumulusci/core/flowrunner.py +888 -0
- cumulusci/core/github.py +665 -0
- cumulusci/core/keychain/__init__.py +24 -0
- cumulusci/core/keychain/base_project_keychain.py +441 -0
- cumulusci/core/keychain/encrypted_file_project_keychain.py +945 -0
- cumulusci/core/keychain/environment_project_keychain.py +7 -0
- cumulusci/core/keychain/serialization.py +152 -0
- cumulusci/core/keychain/subprocess_keychain.py +24 -0
- cumulusci/core/keychain/tests/conftest.py +50 -0
- cumulusci/core/keychain/tests/test_base_project_keychain.py +299 -0
- cumulusci/core/keychain/tests/test_encrypted_file_project_keychain.py +1228 -0
- cumulusci/core/metadeploy/__init__.py +0 -0
- cumulusci/core/metadeploy/api.py +88 -0
- cumulusci/core/metadeploy/plans.py +25 -0
- cumulusci/core/metadeploy/tests/test_api.py +276 -0
- cumulusci/core/runtime.py +115 -0
- cumulusci/core/sfdx.py +162 -0
- cumulusci/core/source/__init__.py +16 -0
- cumulusci/core/source/github.py +50 -0
- cumulusci/core/source/local_folder.py +35 -0
- cumulusci/core/source_transforms/__init__.py +0 -0
- cumulusci/core/source_transforms/tests/test_transforms.py +1091 -0
- cumulusci/core/source_transforms/transforms.py +532 -0
- cumulusci/core/tasks.py +404 -0
- cumulusci/core/template_utils.py +59 -0
- cumulusci/core/tests/__init__.py +0 -0
- cumulusci/core/tests/cassettes/TestDatasetsE2E.test_datasets_e2e.yaml +215 -0
- cumulusci/core/tests/cassettes/TestDatasetsE2E.test_datasets_extract_standard_objects.yaml +199 -0
- cumulusci/core/tests/cassettes/TestDatasetsE2E.test_datasets_read_explicit_extract_declaration.yaml +3 -0
- cumulusci/core/tests/fake_remote_repo/cumulusci.yml +32 -0
- cumulusci/core/tests/fake_remote_repo/tasks/directory/example_2.py +6 -0
- cumulusci/core/tests/fake_remote_repo/tasks/example.py +43 -0
- cumulusci/core/tests/fake_remote_repo_2/cumulusci.yml +11 -0
- cumulusci/core/tests/fake_remote_repo_2/tasks/example_3.py +6 -0
- cumulusci/core/tests/test_datasets_e2e.py +386 -0
- cumulusci/core/tests/test_exceptions.py +11 -0
- cumulusci/core/tests/test_flowrunner.py +836 -0
- cumulusci/core/tests/test_github.py +942 -0
- cumulusci/core/tests/test_sfdx.py +138 -0
- cumulusci/core/tests/test_source.py +678 -0
- cumulusci/core/tests/test_tasks.py +262 -0
- cumulusci/core/tests/test_utils.py +141 -0
- cumulusci/core/tests/test_utils_merge_config.py +276 -0
- cumulusci/core/tests/test_versions.py +76 -0
- cumulusci/core/tests/untrusted_repo_child/cumulusci.yml +7 -0
- cumulusci/core/tests/untrusted_repo_child/tasks/untrusted_child.py +6 -0
- cumulusci/core/tests/untrusted_repo_parent/cumulusci.yml +26 -0
- cumulusci/core/tests/untrusted_repo_parent/tasks/untrusted_parent.py +6 -0
- cumulusci/core/tests/utils.py +116 -0
- cumulusci/core/tests/yaml/global.yaml +0 -0
- cumulusci/core/utils.py +402 -0
- cumulusci/core/versions.py +149 -0
- cumulusci/cumulusci.yml +1621 -0
- cumulusci/files/admin_profile.xml +20 -0
- cumulusci/files/delete_excludes.txt +424 -0
- cumulusci/files/templates/project/README.md +12 -0
- cumulusci/files/templates/project/cumulusci.yml +63 -0
- cumulusci/files/templates/project/dot-gitignore +60 -0
- cumulusci/files/templates/project/mapping.yml +45 -0
- cumulusci/files/templates/project/scratch_def.json +25 -0
- cumulusci/oauth/__init__.py +0 -0
- cumulusci/oauth/client.py +400 -0
- cumulusci/oauth/exceptions.py +9 -0
- cumulusci/oauth/salesforce.py +95 -0
- cumulusci/oauth/tests/__init__.py +0 -0
- cumulusci/oauth/tests/cassettes/test_get_device_code.yaml +22 -0
- cumulusci/oauth/tests/cassettes/test_get_device_oauth_token.yaml +74 -0
- cumulusci/oauth/tests/test_client.py +308 -0
- cumulusci/oauth/tests/test_salesforce.py +46 -0
- cumulusci/plugins/__init__.py +3 -0
- cumulusci/plugins/plugin_base.py +93 -0
- cumulusci/plugins/plugin_loader.py +59 -0
- cumulusci/robotframework/CumulusCI.py +340 -0
- cumulusci/robotframework/CumulusCI.robot +7 -0
- cumulusci/robotframework/Performance.py +165 -0
- cumulusci/robotframework/Salesforce.py +936 -0
- cumulusci/robotframework/Salesforce.robot +192 -0
- cumulusci/robotframework/SalesforceAPI.py +416 -0
- cumulusci/robotframework/SalesforcePlaywright.py +220 -0
- cumulusci/robotframework/SalesforcePlaywright.robot +40 -0
- cumulusci/robotframework/__init__.py +2 -0
- cumulusci/robotframework/base_library.py +39 -0
- cumulusci/robotframework/faker_mixin.py +89 -0
- cumulusci/robotframework/form_handlers.py +222 -0
- cumulusci/robotframework/javascript/cci_init.js +34 -0
- cumulusci/robotframework/javascript/cumulusci.js +4 -0
- cumulusci/robotframework/locator_manager.py +197 -0
- cumulusci/robotframework/locators_56.py +88 -0
- cumulusci/robotframework/locators_57.py +5 -0
- cumulusci/robotframework/pageobjects/BasePageObjects.py +433 -0
- cumulusci/robotframework/pageobjects/ObjectManagerPageObject.py +246 -0
- cumulusci/robotframework/pageobjects/PageObjectLibrary.py +45 -0
- cumulusci/robotframework/pageobjects/PageObjects.py +351 -0
- cumulusci/robotframework/pageobjects/__init__.py +12 -0
- cumulusci/robotframework/pageobjects/baseobjects.py +120 -0
- cumulusci/robotframework/perftests/short/collection_perf.robot +105 -0
- cumulusci/robotframework/tests/CustomObjectTestPage.py +10 -0
- cumulusci/robotframework/tests/FooTestPage.py +8 -0
- cumulusci/robotframework/tests/cumulusci/base.robot +40 -0
- cumulusci/robotframework/tests/cumulusci/bulkdata.robot +38 -0
- cumulusci/robotframework/tests/cumulusci/communities.robot +57 -0
- cumulusci/robotframework/tests/cumulusci/datagen.robot +84 -0
- cumulusci/robotframework/tests/salesforce/TestLibraryA.py +24 -0
- cumulusci/robotframework/tests/salesforce/TestLibraryB.py +20 -0
- cumulusci/robotframework/tests/salesforce/TestListener.py +93 -0
- cumulusci/robotframework/tests/salesforce/api.robot +178 -0
- cumulusci/robotframework/tests/salesforce/browsers.robot +143 -0
- cumulusci/robotframework/tests/salesforce/classic.robot +51 -0
- cumulusci/robotframework/tests/salesforce/create_contact.robot +59 -0
- cumulusci/robotframework/tests/salesforce/faker.robot +68 -0
- cumulusci/robotframework/tests/salesforce/forms.robot +172 -0
- cumulusci/robotframework/tests/salesforce/label_locator.robot +244 -0
- cumulusci/robotframework/tests/salesforce/labels.html +33 -0
- cumulusci/robotframework/tests/salesforce/locators.robot +149 -0
- cumulusci/robotframework/tests/salesforce/pageobjects/base_pageobjects.robot +100 -0
- cumulusci/robotframework/tests/salesforce/pageobjects/example_page_object.py +25 -0
- cumulusci/robotframework/tests/salesforce/pageobjects/listing_page.robot +115 -0
- cumulusci/robotframework/tests/salesforce/pageobjects/objectmanager.robot +74 -0
- cumulusci/robotframework/tests/salesforce/pageobjects/pageobjects.robot +171 -0
- cumulusci/robotframework/tests/salesforce/performance.robot +109 -0
- cumulusci/robotframework/tests/salesforce/playwright/javascript_keywords.robot +33 -0
- cumulusci/robotframework/tests/salesforce/playwright/open_test_browser.robot +48 -0
- cumulusci/robotframework/tests/salesforce/playwright/playwright.robot +24 -0
- cumulusci/robotframework/tests/salesforce/playwright/ui.robot +32 -0
- cumulusci/robotframework/tests/salesforce/populate.robot +89 -0
- cumulusci/robotframework/tests/salesforce/test_testlistener.py +37 -0
- cumulusci/robotframework/tests/salesforce/ui.robot +361 -0
- cumulusci/robotframework/tests/test_cumulusci_library.py +304 -0
- cumulusci/robotframework/tests/test_locator_manager.py +158 -0
- cumulusci/robotframework/tests/test_pageobjects.py +291 -0
- cumulusci/robotframework/tests/test_performance.py +38 -0
- cumulusci/robotframework/tests/test_salesforce.py +79 -0
- cumulusci/robotframework/tests/test_salesforce_locators.py +73 -0
- cumulusci/robotframework/tests/test_template_util.py +53 -0
- cumulusci/robotframework/tests/test_utils.py +106 -0
- cumulusci/robotframework/utils.py +283 -0
- cumulusci/salesforce_api/__init__.py +0 -0
- cumulusci/salesforce_api/exceptions.py +23 -0
- cumulusci/salesforce_api/filterable_objects.py +96 -0
- cumulusci/salesforce_api/mc_soap_envelopes.py +89 -0
- cumulusci/salesforce_api/metadata.py +721 -0
- cumulusci/salesforce_api/org_schema.py +571 -0
- cumulusci/salesforce_api/org_schema_models.py +226 -0
- cumulusci/salesforce_api/package_install.py +265 -0
- cumulusci/salesforce_api/package_zip.py +301 -0
- cumulusci/salesforce_api/rest_deploy.py +148 -0
- cumulusci/salesforce_api/retrieve_profile_api.py +301 -0
- cumulusci/salesforce_api/soap_envelopes.py +177 -0
- cumulusci/salesforce_api/tests/__init__.py +0 -0
- cumulusci/salesforce_api/tests/metadata_test_strings.py +24 -0
- cumulusci/salesforce_api/tests/test_metadata.py +1015 -0
- cumulusci/salesforce_api/tests/test_package_install.py +219 -0
- cumulusci/salesforce_api/tests/test_package_zip.py +380 -0
- cumulusci/salesforce_api/tests/test_rest_deploy.py +264 -0
- cumulusci/salesforce_api/tests/test_retrieve_profile_api.py +337 -0
- cumulusci/salesforce_api/tests/test_utils.py +124 -0
- cumulusci/salesforce_api/utils.py +51 -0
- cumulusci/schema/cumulusci.jsonschema.json +782 -0
- cumulusci/tasks/__init__.py +0 -0
- cumulusci/tasks/apex/__init__.py +0 -0
- cumulusci/tasks/apex/anon.py +157 -0
- cumulusci/tasks/apex/batch.py +180 -0
- cumulusci/tasks/apex/testrunner.py +835 -0
- cumulusci/tasks/apex/tests/cassettes/ManualEditTestApexIntegrationTests.test_run_tests__integration_test.yaml +703 -0
- cumulusci/tasks/apex/tests/test_apex_tasks.py +1558 -0
- cumulusci/tasks/base_source_control_task.py +17 -0
- cumulusci/tasks/bulkdata/__init__.py +15 -0
- cumulusci/tasks/bulkdata/base_generate_data_task.py +96 -0
- cumulusci/tasks/bulkdata/dates.py +97 -0
- cumulusci/tasks/bulkdata/delete.py +156 -0
- cumulusci/tasks/bulkdata/extract.py +441 -0
- cumulusci/tasks/bulkdata/extract_dataset_utils/calculate_dependencies.py +117 -0
- cumulusci/tasks/bulkdata/extract_dataset_utils/extract_yml.py +123 -0
- cumulusci/tasks/bulkdata/extract_dataset_utils/hardcoded_default_declarations.py +49 -0
- cumulusci/tasks/bulkdata/extract_dataset_utils/synthesize_extract_declarations.py +283 -0
- cumulusci/tasks/bulkdata/extract_dataset_utils/tests/test_extract_yml.py +142 -0
- cumulusci/tasks/bulkdata/extract_dataset_utils/tests/test_synthesize_extract_declarations.py +575 -0
- cumulusci/tasks/bulkdata/factory_utils.py +134 -0
- cumulusci/tasks/bulkdata/generate.py +4 -0
- cumulusci/tasks/bulkdata/generate_and_load_data.py +232 -0
- cumulusci/tasks/bulkdata/generate_and_load_data_from_yaml.py +19 -0
- cumulusci/tasks/bulkdata/generate_from_yaml.py +183 -0
- cumulusci/tasks/bulkdata/generate_mapping.py +434 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/dependency_map.py +169 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/extract_mapping_file_generator.py +45 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/generate_mapping_from_declarations.py +121 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/load_mapping_file_generator.py +127 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/mapping_generator_post_processes.py +53 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/mapping_transforms.py +139 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/tests/test_generate_extract_mapping_from_declarations.py +135 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/tests/test_generate_load_mapping_from_declarations.py +330 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/tests/test_mapping_generator_post_processes.py +60 -0
- cumulusci/tasks/bulkdata/generate_mapping_utils/tests/test_mapping_transforms.py +188 -0
- cumulusci/tasks/bulkdata/load.py +1196 -0
- cumulusci/tasks/bulkdata/mapping_parser.py +811 -0
- cumulusci/tasks/bulkdata/query_transformers.py +264 -0
- cumulusci/tasks/bulkdata/select_utils.py +792 -0
- cumulusci/tasks/bulkdata/snowfakery.py +753 -0
- cumulusci/tasks/bulkdata/snowfakery_utils/queue_manager.py +478 -0
- cumulusci/tasks/bulkdata/snowfakery_utils/snowfakery_run_until.py +141 -0
- cumulusci/tasks/bulkdata/snowfakery_utils/snowfakery_working_directory.py +53 -0
- cumulusci/tasks/bulkdata/snowfakery_utils/subtask_configurator.py +64 -0
- cumulusci/tasks/bulkdata/step.py +1242 -0
- cumulusci/tasks/bulkdata/tests/__init__.py +0 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSelect.test_select_random_strategy.yaml +147 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSelect.test_select_similarity_annoy_strategy.yaml +123 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSelect.test_select_similarity_select_and_insert_strategy.yaml +313 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSelect.test_select_similarity_select_and_insert_strategy_bulk.yaml +550 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSelect.test_select_similarity_strategy.yaml +175 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSelect.test_select_standard_strategy.yaml +147 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSnowfakery.test_run_until_records_in_org__multiple_needed.yaml +69 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSnowfakery.test_run_until_records_in_org__none_needed.yaml +22 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSnowfakery.test_run_until_records_in_org__one_needed.yaml +24 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestSnowfakery.test_snowfakery_query_salesforce.yaml +25 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestUpdatesIntegrationTests.test_updates_task.yaml +80 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestUpsert.test_simple_upsert__rest.yaml +270 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestUpsert.test_upsert__rest.yaml +267 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestUpsert.test_upsert_complex_external_id_field__rest.yaml +369 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestUpsert.test_upsert_complex_external_id_field_rest__duplicate_error.yaml +204 -0
- cumulusci/tasks/bulkdata/tests/cassettes/TestUpsert.test_upsert_complex_fields__bulk.yaml +675 -0
- cumulusci/tasks/bulkdata/tests/dummy_data_factory.py +36 -0
- cumulusci/tasks/bulkdata/tests/integration_test_utils.py +49 -0
- cumulusci/tasks/bulkdata/tests/mapping-oid.yml +87 -0
- cumulusci/tasks/bulkdata/tests/mapping_after.yml +38 -0
- cumulusci/tasks/bulkdata/tests/mapping_poly.yml +34 -0
- cumulusci/tasks/bulkdata/tests/mapping_poly_incomplete.yml +20 -0
- cumulusci/tasks/bulkdata/tests/mapping_poly_wrong.yml +21 -0
- cumulusci/tasks/bulkdata/tests/mapping_select.yml +20 -0
- cumulusci/tasks/bulkdata/tests/mapping_select_invalid_strategy.yml +20 -0
- cumulusci/tasks/bulkdata/tests/mapping_select_invalid_threshold__invalid_number.yml +21 -0
- cumulusci/tasks/bulkdata/tests/mapping_select_invalid_threshold__invalid_strategy.yml +21 -0
- cumulusci/tasks/bulkdata/tests/mapping_select_invalid_threshold__non_float.yml +21 -0
- cumulusci/tasks/bulkdata/tests/mapping_select_missing_priority_fields.yml +22 -0
- cumulusci/tasks/bulkdata/tests/mapping_select_no_priority_fields.yml +18 -0
- cumulusci/tasks/bulkdata/tests/mapping_simple.yml +27 -0
- cumulusci/tasks/bulkdata/tests/mapping_v1.yml +28 -0
- cumulusci/tasks/bulkdata/tests/mapping_v2.yml +21 -0
- cumulusci/tasks/bulkdata/tests/mapping_v3.yml +32 -0
- cumulusci/tasks/bulkdata/tests/mapping_vanilla_sf.yml +69 -0
- cumulusci/tasks/bulkdata/tests/mock_data_factory_without_mapping.py +12 -0
- cumulusci/tasks/bulkdata/tests/person_accounts.yml +23 -0
- cumulusci/tasks/bulkdata/tests/person_accounts_minimal.yml +15 -0
- cumulusci/tasks/bulkdata/tests/recordtypes.yml +8 -0
- cumulusci/tasks/bulkdata/tests/recordtypes_2.yml +6 -0
- cumulusci/tasks/bulkdata/tests/recordtypes_with_ispersontype.yml +8 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/child/child2.yml +3 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/child.yml +4 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/gen_npsp_standard_objects.recipe.yml +89 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/include_parent.yml +3 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/npsp_standard_objects_macros.yml +34 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/options.recipe.yml +6 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/query_snowfakery.recipe.yml +16 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/sf_standard_object_macros.yml +83 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/simple_snowfakery.load.yml +2 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/simple_snowfakery.recipe.yml +13 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/simple_snowfakery_2.load.yml +5 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/simple_snowfakery_channels.load.yml +13 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/simple_snowfakery_channels.recipe.yml +12 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/simple_snowfakery_channels_2.load.yml +13 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/unique_values.recipe.yml +4 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/upsert.recipe.yml +23 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/upsert_2.recipe.yml +29 -0
- cumulusci/tasks/bulkdata/tests/snowfakery/upsert_before.yml +10 -0
- cumulusci/tasks/bulkdata/tests/test_base_generate_data_tasks.py +61 -0
- cumulusci/tasks/bulkdata/tests/test_dates.py +99 -0
- cumulusci/tasks/bulkdata/tests/test_delete.py +404 -0
- cumulusci/tasks/bulkdata/tests/test_extract.py +1311 -0
- cumulusci/tasks/bulkdata/tests/test_factory_utils.py +55 -0
- cumulusci/tasks/bulkdata/tests/test_generate_and_load.py +252 -0
- cumulusci/tasks/bulkdata/tests/test_generate_from_snowfakery_task.py +343 -0
- cumulusci/tasks/bulkdata/tests/test_generatemapping.py +1039 -0
- cumulusci/tasks/bulkdata/tests/test_load.py +3175 -0
- cumulusci/tasks/bulkdata/tests/test_mapping_parser.py +1658 -0
- cumulusci/tasks/bulkdata/tests/test_query_db__joins_self_lookups.yml +12 -0
- cumulusci/tasks/bulkdata/tests/test_query_db_joins_lookups.yml +26 -0
- cumulusci/tasks/bulkdata/tests/test_query_db_joins_lookups_select.yml +48 -0
- cumulusci/tasks/bulkdata/tests/test_select.py +171 -0
- cumulusci/tasks/bulkdata/tests/test_select_utils.py +1057 -0
- cumulusci/tasks/bulkdata/tests/test_snowfakery.py +1153 -0
- cumulusci/tasks/bulkdata/tests/test_step.py +3957 -0
- cumulusci/tasks/bulkdata/tests/test_updates.py +513 -0
- cumulusci/tasks/bulkdata/tests/test_upsert.py +1015 -0
- cumulusci/tasks/bulkdata/tests/test_utils.py +158 -0
- cumulusci/tasks/bulkdata/tests/testdata.db +0 -0
- cumulusci/tasks/bulkdata/tests/update_describe.py +50 -0
- cumulusci/tasks/bulkdata/tests/update_person_accounts.yml +23 -0
- cumulusci/tasks/bulkdata/tests/utils.py +114 -0
- cumulusci/tasks/bulkdata/update_data.py +260 -0
- cumulusci/tasks/bulkdata/upsert_utils.py +130 -0
- cumulusci/tasks/bulkdata/utils.py +249 -0
- cumulusci/tasks/command.py +178 -0
- cumulusci/tasks/connectedapp.py +186 -0
- cumulusci/tasks/create_package_version.py +778 -0
- cumulusci/tasks/datadictionary.py +745 -0
- cumulusci/tasks/dx_convert_from.py +26 -0
- cumulusci/tasks/github/__init__.py +17 -0
- cumulusci/tasks/github/base.py +16 -0
- cumulusci/tasks/github/commit_status.py +13 -0
- cumulusci/tasks/github/merge.py +11 -0
- cumulusci/tasks/github/publish.py +11 -0
- cumulusci/tasks/github/pull_request.py +11 -0
- cumulusci/tasks/github/release.py +11 -0
- cumulusci/tasks/github/release_report.py +11 -0
- cumulusci/tasks/github/tag.py +11 -0
- cumulusci/tasks/github/tests/__init__.py +0 -0
- cumulusci/tasks/github/tests/test_util.py +202 -0
- cumulusci/tasks/github/tests/test_vcs_migration.py +44 -0
- cumulusci/tasks/github/tests/util_github_api.py +666 -0
- cumulusci/tasks/github/util.py +252 -0
- cumulusci/tasks/marketing_cloud/__init__.py +0 -0
- cumulusci/tasks/marketing_cloud/api.py +188 -0
- cumulusci/tasks/marketing_cloud/base.py +38 -0
- cumulusci/tasks/marketing_cloud/deploy.py +345 -0
- cumulusci/tasks/marketing_cloud/get_user_info.py +40 -0
- cumulusci/tasks/marketing_cloud/mc_constants.py +1 -0
- cumulusci/tasks/marketing_cloud/tests/__init__.py +0 -0
- cumulusci/tasks/marketing_cloud/tests/conftest.py +46 -0
- cumulusci/tasks/marketing_cloud/tests/expected-payload.json +110 -0
- cumulusci/tasks/marketing_cloud/tests/test_api.py +97 -0
- cumulusci/tasks/marketing_cloud/tests/test_api_soap_envelopes.py +145 -0
- cumulusci/tasks/marketing_cloud/tests/test_base.py +14 -0
- cumulusci/tasks/marketing_cloud/tests/test_deploy.py +400 -0
- cumulusci/tasks/marketing_cloud/tests/test_get_user_info.py +141 -0
- cumulusci/tasks/marketing_cloud/tests/validation-response.json +39 -0
- cumulusci/tasks/metadata/__init__.py +0 -0
- cumulusci/tasks/metadata/ee_src.py +94 -0
- cumulusci/tasks/metadata/managed_src.py +100 -0
- cumulusci/tasks/metadata/metadata_map.yml +868 -0
- cumulusci/tasks/metadata/modify.py +99 -0
- cumulusci/tasks/metadata/package.py +684 -0
- cumulusci/tasks/metadata/tests/__init__.py +0 -0
- cumulusci/tasks/metadata/tests/package_metadata/namespaced_report_folder/.hidden/.keep +0 -0
- cumulusci/tasks/metadata/tests/package_metadata/namespaced_report_folder/destructiveChanges.xml +9 -0
- cumulusci/tasks/metadata/tests/package_metadata/namespaced_report_folder/package.xml +9 -0
- cumulusci/tasks/metadata/tests/package_metadata/namespaced_report_folder/package_install_uninstall.xml +11 -0
- cumulusci/tasks/metadata/tests/package_metadata/namespaced_report_folder/reports/namespace__TestFolder/TestReport.report +3 -0
- cumulusci/tasks/metadata/tests/sample_package.xml +9 -0
- cumulusci/tasks/metadata/tests/test_ee_src.py +112 -0
- cumulusci/tasks/metadata/tests/test_managed_src.py +111 -0
- cumulusci/tasks/metadata/tests/test_modify.py +123 -0
- cumulusci/tasks/metadata/tests/test_package.py +476 -0
- cumulusci/tasks/metadata_etl/__init__.py +29 -0
- cumulusci/tasks/metadata_etl/base.py +436 -0
- cumulusci/tasks/metadata_etl/duplicate_rules.py +24 -0
- cumulusci/tasks/metadata_etl/field_sets.py +70 -0
- cumulusci/tasks/metadata_etl/help_text.py +92 -0
- cumulusci/tasks/metadata_etl/layouts.py +550 -0
- cumulusci/tasks/metadata_etl/objects.py +68 -0
- cumulusci/tasks/metadata_etl/permissions.py +167 -0
- cumulusci/tasks/metadata_etl/picklists.py +221 -0
- cumulusci/tasks/metadata_etl/remote_site_settings.py +99 -0
- cumulusci/tasks/metadata_etl/sharing.py +138 -0
- cumulusci/tasks/metadata_etl/tests/test_base.py +512 -0
- cumulusci/tasks/metadata_etl/tests/test_duplicate_rules.py +22 -0
- cumulusci/tasks/metadata_etl/tests/test_field_sets.py +156 -0
- cumulusci/tasks/metadata_etl/tests/test_help_text.py +387 -0
- cumulusci/tasks/metadata_etl/tests/test_ip_ranges.py +85 -0
- cumulusci/tasks/metadata_etl/tests/test_layouts.py +858 -0
- cumulusci/tasks/metadata_etl/tests/test_objects.py +236 -0
- cumulusci/tasks/metadata_etl/tests/test_permissions.py +223 -0
- cumulusci/tasks/metadata_etl/tests/test_picklists.py +547 -0
- cumulusci/tasks/metadata_etl/tests/test_remote_site_settings.py +46 -0
- cumulusci/tasks/metadata_etl/tests/test_sharing.py +333 -0
- cumulusci/tasks/metadata_etl/tests/test_value_sets.py +298 -0
- cumulusci/tasks/metadata_etl/value_sets.py +106 -0
- cumulusci/tasks/metadeploy.py +393 -0
- cumulusci/tasks/metaxml.py +88 -0
- cumulusci/tasks/preflight/__init__.py +0 -0
- cumulusci/tasks/preflight/dataset_load.py +49 -0
- cumulusci/tasks/preflight/licenses.py +86 -0
- cumulusci/tasks/preflight/packages.py +14 -0
- cumulusci/tasks/preflight/permsets.py +23 -0
- cumulusci/tasks/preflight/recordtypes.py +16 -0
- cumulusci/tasks/preflight/retrieve_tasks.py +30 -0
- cumulusci/tasks/preflight/settings.py +77 -0
- cumulusci/tasks/preflight/sobjects.py +202 -0
- cumulusci/tasks/preflight/tests/test_dataset_load.py +85 -0
- cumulusci/tasks/preflight/tests/test_licenses.py +174 -0
- cumulusci/tasks/preflight/tests/test_packages.py +14 -0
- cumulusci/tasks/preflight/tests/test_permset_preflights.py +51 -0
- cumulusci/tasks/preflight/tests/test_recordtypes.py +30 -0
- cumulusci/tasks/preflight/tests/test_retrieve_tasks.py +62 -0
- cumulusci/tasks/preflight/tests/test_settings.py +130 -0
- cumulusci/tasks/preflight/tests/test_sobjects.py +231 -0
- cumulusci/tasks/push/README.md +59 -0
- cumulusci/tasks/push/__init__.py +0 -0
- cumulusci/tasks/push/push_api.py +659 -0
- cumulusci/tasks/push/pushfails.py +136 -0
- cumulusci/tasks/push/tasks.py +476 -0
- cumulusci/tasks/push/tests/conftest.py +263 -0
- cumulusci/tasks/push/tests/test_push_api.py +951 -0
- cumulusci/tasks/push/tests/test_push_tasks.py +659 -0
- cumulusci/tasks/release_notes/README.md +63 -0
- cumulusci/tasks/release_notes/__init__.py +0 -0
- cumulusci/tasks/release_notes/exceptions.py +5 -0
- cumulusci/tasks/release_notes/generator.py +137 -0
- cumulusci/tasks/release_notes/parser.py +232 -0
- cumulusci/tasks/release_notes/provider.py +44 -0
- cumulusci/tasks/release_notes/task.py +300 -0
- cumulusci/tasks/release_notes/tests/__init__.py +0 -0
- cumulusci/tasks/release_notes/tests/change_notes/full/example1.md +17 -0
- cumulusci/tasks/release_notes/tests/change_notes/multi/1.txt +1 -0
- cumulusci/tasks/release_notes/tests/change_notes/multi/2.txt +1 -0
- cumulusci/tasks/release_notes/tests/change_notes/multi/3.txt +1 -0
- cumulusci/tasks/release_notes/tests/change_notes/single/1.txt +1 -0
- cumulusci/tasks/release_notes/tests/test_generator.py +582 -0
- cumulusci/tasks/release_notes/tests/test_parser.py +867 -0
- cumulusci/tasks/release_notes/tests/test_provider.py +512 -0
- cumulusci/tasks/release_notes/tests/test_task.py +461 -0
- cumulusci/tasks/release_notes/tests/utils.py +153 -0
- cumulusci/tasks/robotframework/__init__.py +3 -0
- cumulusci/tasks/robotframework/debugger/DebugListener.py +100 -0
- cumulusci/tasks/robotframework/debugger/__init__.py +10 -0
- cumulusci/tasks/robotframework/debugger/model.py +87 -0
- cumulusci/tasks/robotframework/debugger/ui.py +259 -0
- cumulusci/tasks/robotframework/libdoc.py +269 -0
- cumulusci/tasks/robotframework/robotframework.py +392 -0
- cumulusci/tasks/robotframework/stylesheet.css +130 -0
- cumulusci/tasks/robotframework/template.html +109 -0
- cumulusci/tasks/robotframework/tests/TestLibrary.py +18 -0
- cumulusci/tasks/robotframework/tests/TestPageObjects.py +31 -0
- cumulusci/tasks/robotframework/tests/TestResource.robot +8 -0
- cumulusci/tasks/robotframework/tests/failing_tests.robot +16 -0
- cumulusci/tasks/robotframework/tests/performance.robot +23 -0
- cumulusci/tasks/robotframework/tests/test_browser_proxies.py +137 -0
- cumulusci/tasks/robotframework/tests/test_debugger.py +360 -0
- cumulusci/tasks/robotframework/tests/test_robot_parallel.py +141 -0
- cumulusci/tasks/robotframework/tests/test_robotframework.py +860 -0
- cumulusci/tasks/salesforce/BaseRetrieveMetadata.py +58 -0
- cumulusci/tasks/salesforce/BaseSalesforceApiTask.py +45 -0
- cumulusci/tasks/salesforce/BaseSalesforceMetadataApiTask.py +18 -0
- cumulusci/tasks/salesforce/BaseSalesforceTask.py +4 -0
- cumulusci/tasks/salesforce/BaseUninstallMetadata.py +41 -0
- cumulusci/tasks/salesforce/CreateCommunity.py +124 -0
- cumulusci/tasks/salesforce/CreatePackage.py +29 -0
- cumulusci/tasks/salesforce/Deploy.py +240 -0
- cumulusci/tasks/salesforce/DeployBundles.py +88 -0
- cumulusci/tasks/salesforce/DescribeMetadataTypes.py +26 -0
- cumulusci/tasks/salesforce/EnsureRecordTypes.py +202 -0
- cumulusci/tasks/salesforce/GetInstalledPackages.py +8 -0
- cumulusci/tasks/salesforce/ListCommunities.py +40 -0
- cumulusci/tasks/salesforce/ListCommunityTemplates.py +19 -0
- cumulusci/tasks/salesforce/PublishCommunity.py +62 -0
- cumulusci/tasks/salesforce/RetrievePackaged.py +41 -0
- cumulusci/tasks/salesforce/RetrieveReportsAndDashboards.py +82 -0
- cumulusci/tasks/salesforce/RetrieveUnpackaged.py +36 -0
- cumulusci/tasks/salesforce/SOQLQuery.py +39 -0
- cumulusci/tasks/salesforce/UninstallLocal.py +15 -0
- cumulusci/tasks/salesforce/UninstallLocalBundles.py +28 -0
- cumulusci/tasks/salesforce/UninstallLocalNamespacedBundles.py +58 -0
- cumulusci/tasks/salesforce/UninstallPackage.py +32 -0
- cumulusci/tasks/salesforce/UninstallPackaged.py +56 -0
- cumulusci/tasks/salesforce/UpdateAdminProfile.py +8 -0
- cumulusci/tasks/salesforce/__init__.py +79 -0
- cumulusci/tasks/salesforce/activate_flow.py +74 -0
- cumulusci/tasks/salesforce/check_components.py +324 -0
- cumulusci/tasks/salesforce/composite.py +142 -0
- cumulusci/tasks/salesforce/create_permission_sets.py +35 -0
- cumulusci/tasks/salesforce/custom_settings.py +134 -0
- cumulusci/tasks/salesforce/custom_settings_wait.py +132 -0
- cumulusci/tasks/salesforce/enable_prediction.py +107 -0
- cumulusci/tasks/salesforce/insert_record.py +40 -0
- cumulusci/tasks/salesforce/install_package_version.py +242 -0
- cumulusci/tasks/salesforce/license_preflights.py +8 -0
- cumulusci/tasks/salesforce/network_member_group.py +178 -0
- cumulusci/tasks/salesforce/nonsourcetracking.py +228 -0
- cumulusci/tasks/salesforce/org_settings.py +193 -0
- cumulusci/tasks/salesforce/package_upload.py +328 -0
- cumulusci/tasks/salesforce/profiles.py +74 -0
- cumulusci/tasks/salesforce/promote_package_version.py +376 -0
- cumulusci/tasks/salesforce/retrieve_profile.py +195 -0
- cumulusci/tasks/salesforce/salesforce_files.py +244 -0
- cumulusci/tasks/salesforce/sourcetracking.py +507 -0
- cumulusci/tasks/salesforce/tests/__init__.py +3 -0
- cumulusci/tasks/salesforce/tests/test_CreateCommunity.py +278 -0
- cumulusci/tasks/salesforce/tests/test_CreatePackage.py +22 -0
- cumulusci/tasks/salesforce/tests/test_Deploy.py +470 -0
- cumulusci/tasks/salesforce/tests/test_DeployBundles.py +76 -0
- cumulusci/tasks/salesforce/tests/test_EnsureRecordTypes.py +345 -0
- cumulusci/tasks/salesforce/tests/test_ListCommunities.py +84 -0
- cumulusci/tasks/salesforce/tests/test_ListCommunityTemplates.py +49 -0
- cumulusci/tasks/salesforce/tests/test_PackageUpload.py +547 -0
- cumulusci/tasks/salesforce/tests/test_ProfileGrantAllAccess.py +699 -0
- cumulusci/tasks/salesforce/tests/test_PublishCommunity.py +181 -0
- cumulusci/tasks/salesforce/tests/test_RetrievePackaged.py +24 -0
- cumulusci/tasks/salesforce/tests/test_RetrieveReportsAndDashboards.py +56 -0
- cumulusci/tasks/salesforce/tests/test_RetrieveUnpackaged.py +21 -0
- cumulusci/tasks/salesforce/tests/test_SOQLQuery.py +30 -0
- cumulusci/tasks/salesforce/tests/test_UninstallLocal.py +15 -0
- cumulusci/tasks/salesforce/tests/test_UninstallLocalBundles.py +19 -0
- cumulusci/tasks/salesforce/tests/test_UninstallLocalNamespacedBundles.py +22 -0
- cumulusci/tasks/salesforce/tests/test_UninstallPackage.py +19 -0
- cumulusci/tasks/salesforce/tests/test_UninstallPackaged.py +66 -0
- cumulusci/tasks/salesforce/tests/test_UninstallPackagedIncremental.py +127 -0
- cumulusci/tasks/salesforce/tests/test_activate_flow.py +132 -0
- cumulusci/tasks/salesforce/tests/test_base_tasks.py +110 -0
- cumulusci/tasks/salesforce/tests/test_check_components.py +445 -0
- cumulusci/tasks/salesforce/tests/test_composite.py +250 -0
- cumulusci/tasks/salesforce/tests/test_create_permission_sets.py +41 -0
- cumulusci/tasks/salesforce/tests/test_custom_settings.py +227 -0
- cumulusci/tasks/salesforce/tests/test_custom_settings_wait.py +174 -0
- cumulusci/tasks/salesforce/tests/test_describemetadatatypes.py +18 -0
- cumulusci/tasks/salesforce/tests/test_enable_prediction.py +240 -0
- cumulusci/tasks/salesforce/tests/test_insert_record.py +110 -0
- cumulusci/tasks/salesforce/tests/test_install_package_version.py +464 -0
- cumulusci/tasks/salesforce/tests/test_network_member_group.py +444 -0
- cumulusci/tasks/salesforce/tests/test_nonsourcetracking.py +235 -0
- cumulusci/tasks/salesforce/tests/test_org_settings.py +407 -0
- cumulusci/tasks/salesforce/tests/test_profiles.py +202 -0
- cumulusci/tasks/salesforce/tests/test_retrieve_profile.py +287 -0
- cumulusci/tasks/salesforce/tests/test_salesforce_files.py +228 -0
- cumulusci/tasks/salesforce/tests/test_sourcetracking.py +350 -0
- cumulusci/tasks/salesforce/tests/test_trigger_handlers.py +300 -0
- cumulusci/tasks/salesforce/tests/test_update_dependencies.py +509 -0
- cumulusci/tasks/salesforce/tests/util.py +79 -0
- cumulusci/tasks/salesforce/trigger_handlers.py +119 -0
- cumulusci/tasks/salesforce/uninstall_packaged_incremental.py +136 -0
- cumulusci/tasks/salesforce/update_dependencies.py +290 -0
- cumulusci/tasks/salesforce/update_profile.py +339 -0
- cumulusci/tasks/salesforce/users/permsets.py +227 -0
- cumulusci/tasks/salesforce/users/photos.py +162 -0
- cumulusci/tasks/salesforce/users/tests/photo.mock.txt +1 -0
- cumulusci/tasks/salesforce/users/tests/test_permsets.py +950 -0
- cumulusci/tasks/salesforce/users/tests/test_photos.py +373 -0
- cumulusci/tasks/sample_data/capture_sample_data.py +77 -0
- cumulusci/tasks/sample_data/load_sample_data.py +85 -0
- cumulusci/tasks/sample_data/test_capture_sample_data.py +117 -0
- cumulusci/tasks/sample_data/test_load_sample_data.py +121 -0
- cumulusci/tasks/sfdx.py +83 -0
- cumulusci/tasks/tests/__init__.py +1 -0
- cumulusci/tasks/tests/conftest.py +30 -0
- cumulusci/tasks/tests/test_command.py +129 -0
- cumulusci/tasks/tests/test_connectedapp.py +236 -0
- cumulusci/tasks/tests/test_create_package_version.py +847 -0
- cumulusci/tasks/tests/test_datadictionary.py +1575 -0
- cumulusci/tasks/tests/test_dx_convert_from.py +60 -0
- cumulusci/tasks/tests/test_metadeploy.py +624 -0
- cumulusci/tasks/tests/test_metaxml.py +99 -0
- cumulusci/tasks/tests/test_promote_package_version.py +488 -0
- cumulusci/tasks/tests/test_pushfails.py +96 -0
- cumulusci/tasks/tests/test_salesforce.py +72 -0
- cumulusci/tasks/tests/test_sfdx.py +105 -0
- cumulusci/tasks/tests/test_util.py +207 -0
- cumulusci/tasks/util.py +261 -0
- cumulusci/tasks/vcs/__init__.py +19 -0
- cumulusci/tasks/vcs/commit_status.py +58 -0
- cumulusci/tasks/vcs/create_commit_status.py +37 -0
- cumulusci/tasks/vcs/download_extract.py +199 -0
- cumulusci/tasks/vcs/merge.py +298 -0
- cumulusci/tasks/vcs/publish.py +207 -0
- cumulusci/tasks/vcs/pull_request.py +9 -0
- cumulusci/tasks/vcs/release.py +134 -0
- cumulusci/tasks/vcs/release_report.py +105 -0
- cumulusci/tasks/vcs/tag.py +31 -0
- cumulusci/tasks/vcs/tests/github/test_commit_status.py +196 -0
- cumulusci/tasks/vcs/tests/github/test_download_extract.py +896 -0
- cumulusci/tasks/vcs/tests/github/test_merge.py +1118 -0
- cumulusci/tasks/vcs/tests/github/test_publish.py +823 -0
- cumulusci/tasks/vcs/tests/github/test_pull_request.py +29 -0
- cumulusci/tasks/vcs/tests/github/test_release.py +390 -0
- cumulusci/tasks/vcs/tests/github/test_release_report.py +109 -0
- cumulusci/tasks/vcs/tests/github/test_tag.py +90 -0
- cumulusci/tasks/vlocity/exceptions.py +2 -0
- cumulusci/tasks/vlocity/tests/test_vlocity.py +283 -0
- cumulusci/tasks/vlocity/vlocity.py +342 -0
- cumulusci/tests/__init__.py +1 -0
- cumulusci/tests/cassettes/GET_sobjects_Account_PersonAccount_describe.yaml +18 -0
- cumulusci/tests/cassettes/TestIntegrationInfrastructure.test_integration_tests.yaml +19 -0
- cumulusci/tests/pytest_plugins/pytest_sf_orgconnect.py +307 -0
- cumulusci/tests/pytest_plugins/pytest_sf_vcr.py +275 -0
- cumulusci/tests/pytest_plugins/pytest_sf_vcr_serializer.py +160 -0
- cumulusci/tests/pytest_plugins/pytest_typeguard.py +5 -0
- cumulusci/tests/pytest_plugins/test_vcr_string_compressor.py +49 -0
- cumulusci/tests/pytest_plugins/vcr_string_compressor.py +97 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Account_describe.yaml +18 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Case_describe.yaml +18 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Contact_describe.yaml +4838 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Custom__c_describe.yaml +242 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Event_describe.yaml +19 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Global_describe.yaml +1338 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Lead_describe.yaml +18 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_OpportunityContactRole_describe.yaml +34 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Opportunity_describe.yaml +1261 -0
- cumulusci/tests/shared_cassettes/GET_sobjects_Organization.yaml +49 -0
- cumulusci/tests/shared_cassettes/vcr_string_templates/batchInfoList_xml.tpl +15 -0
- cumulusci/tests/shared_cassettes/vcr_string_templates/batchInfo_xml.tpl +13 -0
- cumulusci/tests/shared_cassettes/vcr_string_templates/jobInfo_insert_xml.tpl +24 -0
- cumulusci/tests/shared_cassettes/vcr_string_templates/jobInfo_upsert_xml.tpl +25 -0
- cumulusci/tests/test_entry_points.py +20 -0
- cumulusci/tests/test_integration_infrastructure.py +131 -0
- cumulusci/tests/test_main.py +9 -0
- cumulusci/tests/test_schema.py +32 -0
- cumulusci/tests/test_utils.py +657 -0
- cumulusci/tests/test_vcr_serializer.py +134 -0
- cumulusci/tests/uncompressed_cassette.yaml +83 -0
- cumulusci/tests/util.py +344 -0
- cumulusci/utils/__init__.py +731 -0
- cumulusci/utils/classutils.py +9 -0
- cumulusci/utils/collections.py +32 -0
- cumulusci/utils/deprecation.py +11 -0
- cumulusci/utils/encryption.py +31 -0
- cumulusci/utils/fileutils.py +295 -0
- cumulusci/utils/git.py +142 -0
- cumulusci/utils/http/multi_request.py +214 -0
- cumulusci/utils/http/requests_utils.py +103 -0
- cumulusci/utils/http/tests/cassettes/ManualEditTestCompositeParallelSalesforce.test_http_headers.yaml +32 -0
- cumulusci/utils/http/tests/cassettes/TestCompositeParallelSalesforce.test_composite_parallel_salesforce.yaml +65 -0
- cumulusci/utils/http/tests/cassettes/TestCompositeParallelSalesforce.test_errors.yaml +24 -0
- cumulusci/utils/http/tests/cassettes/TestCompositeParallelSalesforce.test_reference_ids.yaml +49 -0
- cumulusci/utils/http/tests/test_multi_request.py +255 -0
- cumulusci/utils/iterators.py +21 -0
- cumulusci/utils/logging.py +128 -0
- cumulusci/utils/metaprogramming.py +10 -0
- cumulusci/utils/options.py +138 -0
- cumulusci/utils/parallel/queries_in_parallel/run_queries_in_parallel.py +29 -0
- cumulusci/utils/parallel/queries_in_parallel/tests/test_run_queries_in_parallel.py +50 -0
- cumulusci/utils/parallel/task_worker_queues/parallel_worker.py +238 -0
- cumulusci/utils/parallel/task_worker_queues/parallel_worker_queue.py +243 -0
- cumulusci/utils/parallel/task_worker_queues/tests/test_parallel_worker.py +353 -0
- cumulusci/utils/salesforce/count_sobjects.py +46 -0
- cumulusci/utils/salesforce/soql.py +17 -0
- cumulusci/utils/salesforce/tests/cassettes/ManualEdit_TestCountSObjects.test_count_sobjects__network_errors.yaml +23 -0
- cumulusci/utils/salesforce/tests/cassettes/TestCountSObjects.test_count_sobjects__errors.yaml +33 -0
- cumulusci/utils/salesforce/tests/cassettes/TestCountSObjects.test_count_sobjects_simple.yaml +29 -0
- cumulusci/utils/salesforce/tests/test_count_sobjects.py +29 -0
- cumulusci/utils/salesforce/tests/test_soql.py +30 -0
- cumulusci/utils/tests/cassettes/ManualEditTestDescribeOrg.test_minimal_schema.yaml +36 -0
- cumulusci/utils/tests/cassettes/ManualEdit_test_describe_to_sql.yaml +191 -0
- cumulusci/utils/tests/test_fileutils.py +284 -0
- cumulusci/utils/tests/test_git.py +85 -0
- cumulusci/utils/tests/test_logging.py +70 -0
- cumulusci/utils/tests/test_option_parsing.py +188 -0
- cumulusci/utils/tests/test_org_schema.py +691 -0
- cumulusci/utils/tests/test_org_schema_models.py +79 -0
- cumulusci/utils/tests/test_waiting.py +25 -0
- cumulusci/utils/version_strings.py +391 -0
- cumulusci/utils/waiting.py +42 -0
- cumulusci/utils/xml/__init__.py +91 -0
- cumulusci/utils/xml/metadata_tree.py +299 -0
- cumulusci/utils/xml/robot_xml.py +114 -0
- cumulusci/utils/xml/salesforce_encoding.py +100 -0
- cumulusci/utils/xml/test/test_metadata_tree.py +251 -0
- cumulusci/utils/xml/test/test_salesforce_encoding.py +173 -0
- cumulusci/utils/yaml/cumulusci_yml.py +401 -0
- cumulusci/utils/yaml/model_parser.py +156 -0
- cumulusci/utils/yaml/safer_loader.py +74 -0
- cumulusci/utils/yaml/tests/bad_cci.yml +5 -0
- cumulusci/utils/yaml/tests/cassettes/TestCumulusciYml.test_validate_url__with_errors.yaml +20 -0
- cumulusci/utils/yaml/tests/test_cumulusci_yml.py +286 -0
- cumulusci/utils/yaml/tests/test_model_parser.py +175 -0
- cumulusci/utils/yaml/tests/test_safer_loader.py +88 -0
- cumulusci/utils/ziputils.py +61 -0
- cumulusci/vcs/base.py +143 -0
- cumulusci/vcs/bootstrap.py +272 -0
- cumulusci/vcs/github/__init__.py +24 -0
- cumulusci/vcs/github/adapter.py +689 -0
- cumulusci/vcs/github/release_notes/generator.py +219 -0
- cumulusci/vcs/github/release_notes/parser.py +151 -0
- cumulusci/vcs/github/release_notes/provider.py +143 -0
- cumulusci/vcs/github/service.py +569 -0
- cumulusci/vcs/github/tests/test_adapter.py +138 -0
- cumulusci/vcs/github/tests/test_service.py +408 -0
- cumulusci/vcs/models.py +586 -0
- cumulusci/vcs/tests/conftest.py +41 -0
- cumulusci/vcs/tests/dummy_service.py +241 -0
- cumulusci/vcs/tests/test_vcs_base.py +687 -0
- cumulusci/vcs/tests/test_vcs_bootstrap.py +727 -0
- cumulusci/vcs/utils/__init__.py +31 -0
- cumulusci/vcs/vcs_source.py +287 -0
- cumulusci_plus-5.0.0.dist-info/METADATA +145 -0
- cumulusci_plus-5.0.0.dist-info/RECORD +744 -0
- cumulusci_plus-5.0.0.dist-info/WHEEL +4 -0
- cumulusci_plus-5.0.0.dist-info/entry_points.txt +3 -0
- cumulusci_plus-5.0.0.dist-info/licenses/AUTHORS.rst +41 -0
- cumulusci_plus-5.0.0.dist-info/licenses/LICENSE +30 -0
|
@@ -0,0 +1,1558 @@
|
|
|
1
|
+
import http.client
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
import tempfile
|
|
6
|
+
from copy import deepcopy
|
|
7
|
+
from unittest.mock import MagicMock, Mock, patch
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
import responses
|
|
11
|
+
from responses.matchers import query_string_matcher
|
|
12
|
+
from simple_salesforce import SalesforceGeneralError
|
|
13
|
+
|
|
14
|
+
from cumulusci.core import exceptions as exc
|
|
15
|
+
from cumulusci.core.config import (
|
|
16
|
+
BaseProjectConfig,
|
|
17
|
+
OrgConfig,
|
|
18
|
+
TaskConfig,
|
|
19
|
+
UniversalConfig,
|
|
20
|
+
)
|
|
21
|
+
from cumulusci.core.exceptions import (
|
|
22
|
+
ApexCompilationException,
|
|
23
|
+
ApexException,
|
|
24
|
+
ApexTestException,
|
|
25
|
+
CumulusCIException,
|
|
26
|
+
SalesforceException,
|
|
27
|
+
TaskOptionsError,
|
|
28
|
+
)
|
|
29
|
+
from cumulusci.core.keychain import BaseProjectKeychain
|
|
30
|
+
from cumulusci.core.tests.utils import MockLoggerMixin
|
|
31
|
+
from cumulusci.tasks.apex.anon import AnonymousApexTask
|
|
32
|
+
from cumulusci.tasks.apex.batch import BatchApexWait
|
|
33
|
+
from cumulusci.tasks.apex.testrunner import RunApexTests
|
|
34
|
+
from cumulusci.utils.version_strings import StrictVersion
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@patch(
|
|
38
|
+
"cumulusci.core.tasks.BaseSalesforceTask._update_credentials",
|
|
39
|
+
MagicMock(return_value=None),
|
|
40
|
+
)
|
|
41
|
+
class TestRunApexTests(MockLoggerMixin):
|
|
42
|
+
def setup_method(self):
|
|
43
|
+
self._task_log_handler.reset()
|
|
44
|
+
self.task_log = self._task_log_handler.messages
|
|
45
|
+
self.api_version = 38.0
|
|
46
|
+
self.universal_config = UniversalConfig(
|
|
47
|
+
{"project": {"api_version": self.api_version}}
|
|
48
|
+
)
|
|
49
|
+
self.task_config = TaskConfig()
|
|
50
|
+
self.task_config.config["options"] = {
|
|
51
|
+
"junit_output": "results_junit.xml",
|
|
52
|
+
"poll_interval": 1,
|
|
53
|
+
"test_name_match": "%_TEST",
|
|
54
|
+
}
|
|
55
|
+
self.project_config = BaseProjectConfig(
|
|
56
|
+
self.universal_config, config={"noyaml": True}
|
|
57
|
+
)
|
|
58
|
+
self.project_config.config["project"] = {
|
|
59
|
+
"package": {"api_version": self.api_version}
|
|
60
|
+
}
|
|
61
|
+
keychain = BaseProjectKeychain(self.project_config, "")
|
|
62
|
+
self.project_config.set_keychain(keychain)
|
|
63
|
+
self.org_config = OrgConfig(
|
|
64
|
+
{
|
|
65
|
+
"id": "foo/1",
|
|
66
|
+
"instance_url": "https://example.com",
|
|
67
|
+
"access_token": "abc123",
|
|
68
|
+
},
|
|
69
|
+
"test",
|
|
70
|
+
)
|
|
71
|
+
self.base_tooling_url = "{}/services/data/v{}/tooling/".format(
|
|
72
|
+
self.org_config.instance_url, self.api_version
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
def _mock_apex_class_query(self, name="TestClass_TEST", namespace=None):
|
|
76
|
+
namespace_param = "null" if namespace is None else f"%27{namespace}%27"
|
|
77
|
+
url = self.base_tooling_url + "query/"
|
|
78
|
+
query_string = (
|
|
79
|
+
"q=SELECT+Id%2C+Name+"
|
|
80
|
+
+ f"FROM+ApexClass+WHERE+NamespacePrefix+%3D+{namespace_param}"
|
|
81
|
+
+ "+AND+%28Name+LIKE+%27%25_TEST%27%29"
|
|
82
|
+
)
|
|
83
|
+
expected_response = {
|
|
84
|
+
"done": True,
|
|
85
|
+
"records": [{"Id": 1, "Name": name}],
|
|
86
|
+
"totalSize": 1,
|
|
87
|
+
}
|
|
88
|
+
responses.add(
|
|
89
|
+
responses.GET,
|
|
90
|
+
url,
|
|
91
|
+
match=[query_string_matcher(query_string)],
|
|
92
|
+
json=expected_response,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
def _get_mock_test_query_results(self, methodnames, outcomes, messages):
|
|
96
|
+
record_base = {
|
|
97
|
+
"attributes": {
|
|
98
|
+
"type": "ApexTestResult",
|
|
99
|
+
"url": "/services/data/v40.0/tooling/sobjects/ApexTestResult/07M41000009gbT3EAI",
|
|
100
|
+
},
|
|
101
|
+
"ApexClass": {
|
|
102
|
+
"attributes": {
|
|
103
|
+
"type": "ApexClass",
|
|
104
|
+
"url": "/services/data/v40.0/tooling/sobjects/ApexClass/01p4100000Fu4Z0AAJ",
|
|
105
|
+
},
|
|
106
|
+
"Name": "EP_TaskDependency_TEST",
|
|
107
|
+
},
|
|
108
|
+
"ApexClassId": 1,
|
|
109
|
+
"ApexLogId": 1,
|
|
110
|
+
"TestTimestamp": "2017-07-18T20:36:04.000+0000",
|
|
111
|
+
"Id": "07M41000009gbT3EAI",
|
|
112
|
+
"Message": None,
|
|
113
|
+
"MethodName": None,
|
|
114
|
+
"Outcome": None,
|
|
115
|
+
"QueueItem": {
|
|
116
|
+
"attributes": {
|
|
117
|
+
"type": "ApexTestQueueItem",
|
|
118
|
+
"url": "/services/data/v40.0/tooling/sobjects/ApexTestQueueItem/70941000000q7VsAAI",
|
|
119
|
+
},
|
|
120
|
+
"Status": "Completed",
|
|
121
|
+
"ExtendedStatus": "(4/4)",
|
|
122
|
+
},
|
|
123
|
+
"RunTime": 1707,
|
|
124
|
+
"StackTrace": "1. ParentFunction\n2. ChildFunction",
|
|
125
|
+
"Status": "Completed",
|
|
126
|
+
"Name": "TestClass_TEST",
|
|
127
|
+
"ApexTestResults": {
|
|
128
|
+
"size": 1,
|
|
129
|
+
"totalSize": 1,
|
|
130
|
+
"done": True,
|
|
131
|
+
"queryLocator": None,
|
|
132
|
+
"entityTypeName": "ApexTestResultLimits",
|
|
133
|
+
"records": [
|
|
134
|
+
{
|
|
135
|
+
"attributes": {
|
|
136
|
+
"type": "ApexTestResultLimits",
|
|
137
|
+
"url": "/services/data/v40.0/tooling/sobjects/ApexTestResultLimits/05n41000002Y7OQAA0",
|
|
138
|
+
},
|
|
139
|
+
"Id": "05n41000002Y7OQAA0",
|
|
140
|
+
"Callouts": 0,
|
|
141
|
+
"AsyncCalls": 0,
|
|
142
|
+
"DmlRows": 5,
|
|
143
|
+
"Email": 0,
|
|
144
|
+
"LimitContext": "SYNC",
|
|
145
|
+
"LimitExceptions": None,
|
|
146
|
+
"MobilePush": 0,
|
|
147
|
+
"QueryRows": 20,
|
|
148
|
+
"Sosl": 0,
|
|
149
|
+
"Cpu": 471,
|
|
150
|
+
"Dml": 4,
|
|
151
|
+
"Soql": 5,
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return_value = {"done": True, "records": []}
|
|
158
|
+
|
|
159
|
+
for method_name, outcome, message in zip(methodnames, outcomes, messages):
|
|
160
|
+
this_result = deepcopy(record_base)
|
|
161
|
+
this_result["Message"] = message
|
|
162
|
+
this_result["Outcome"] = outcome
|
|
163
|
+
this_result["MethodName"] = method_name
|
|
164
|
+
return_value["records"].append(this_result)
|
|
165
|
+
|
|
166
|
+
return return_value
|
|
167
|
+
|
|
168
|
+
def _get_mock_test_query_url(self, job_id):
|
|
169
|
+
return (
|
|
170
|
+
self.base_tooling_url + "query/",
|
|
171
|
+
f"q=%0ASELECT+Id%2CApexClassId%2CTestTimestamp%2C%0A+++++++Message%2CMethodName%2COutcome%2C%0A+++++++RunTime%2CStackTrace%2C%0A+++++++%28SELECT%0A++++++++++Id%2CCallouts%2CAsyncCalls%2CDmlRows%2CEmail%2C%0A++++++++++LimitContext%2CLimitExceptions%2CMobilePush%2C%0A++++++++++QueryRows%2CSosl%2CCpu%2CDml%2CSoql%0A++++++++FROM+ApexTestResults%29%0AFROM+ApexTestResult%0AWHERE+AsyncApexJobId%3D%27{job_id}%27%0A",
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
def _get_mock_testqueueitem_status_query_url(self, job_id):
|
|
175
|
+
return (
|
|
176
|
+
(self.base_tooling_url + "query/"),
|
|
177
|
+
f"q=SELECT+Id%2C+Status%2C+ExtendedStatus%2C+ApexClassId+FROM+ApexTestQueueItem+WHERE+ParentJobId+%3D+%27{job_id}%27+AND+Status+%3D+%27Failed%27",
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
def _mock_get_test_results(
|
|
181
|
+
self,
|
|
182
|
+
outcome="Pass",
|
|
183
|
+
message="Test Passed",
|
|
184
|
+
job_id="JOB_ID1234567",
|
|
185
|
+
methodname=["TestMethod"],
|
|
186
|
+
):
|
|
187
|
+
url, query_string = self._get_mock_test_query_url(job_id)
|
|
188
|
+
|
|
189
|
+
expected_response = self._get_mock_test_query_results(
|
|
190
|
+
methodname, [outcome], [message]
|
|
191
|
+
)
|
|
192
|
+
responses.add(
|
|
193
|
+
responses.GET,
|
|
194
|
+
url,
|
|
195
|
+
match=[query_string_matcher(query_string)],
|
|
196
|
+
json=expected_response,
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
def _mock_get_test_results_multiple(
|
|
200
|
+
self, method_names, outcomes, messages, job_id="JOB_ID1234567"
|
|
201
|
+
):
|
|
202
|
+
url, query_string = self._get_mock_test_query_url(job_id)
|
|
203
|
+
|
|
204
|
+
expected_response = self._get_mock_test_query_results(
|
|
205
|
+
method_names, outcomes, messages
|
|
206
|
+
)
|
|
207
|
+
responses.add(
|
|
208
|
+
responses.GET,
|
|
209
|
+
url,
|
|
210
|
+
match=[query_string_matcher(query_string)],
|
|
211
|
+
json=expected_response,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
def _mock_get_failed_test_classes(self, job_id="JOB_ID1234567"):
|
|
215
|
+
url, query_string = self._get_mock_testqueueitem_status_query_url(job_id)
|
|
216
|
+
|
|
217
|
+
responses.add(
|
|
218
|
+
responses.GET,
|
|
219
|
+
url,
|
|
220
|
+
match=[query_string_matcher(query_string)],
|
|
221
|
+
json={"totalSize": 0, "records": [], "done": True},
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
def _mock_get_failed_test_classes_failure(self, job_id="JOB_ID1234567"):
|
|
225
|
+
url, query_string = self._get_mock_testqueueitem_status_query_url(job_id)
|
|
226
|
+
|
|
227
|
+
responses.add(
|
|
228
|
+
responses.GET,
|
|
229
|
+
url,
|
|
230
|
+
match=[query_string_matcher(query_string)],
|
|
231
|
+
json={
|
|
232
|
+
"totalSize": 1,
|
|
233
|
+
"records": [
|
|
234
|
+
{
|
|
235
|
+
"Id": "0000000000000000",
|
|
236
|
+
"ApexClassId": 1,
|
|
237
|
+
"Status": "Failed",
|
|
238
|
+
"ExtendedStatus": "Double-plus ungood",
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"done": True,
|
|
242
|
+
},
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
def _mock_get_symboltable(self):
|
|
246
|
+
url = self.base_tooling_url + "query/"
|
|
247
|
+
query_string = (
|
|
248
|
+
"q=SELECT+SymbolTable+FROM+ApexClass+WHERE+Name%3D%27TestClass_TEST%27"
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
responses.add(
|
|
252
|
+
responses.GET,
|
|
253
|
+
url,
|
|
254
|
+
match=[query_string_matcher(query_string)],
|
|
255
|
+
json={
|
|
256
|
+
"records": [
|
|
257
|
+
{
|
|
258
|
+
"SymbolTable": {
|
|
259
|
+
"methods": [
|
|
260
|
+
{"name": "test1", "annotations": [{"name": "isTest"}]}
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
def _mock_get_symboltable_failure(self):
|
|
269
|
+
url = (
|
|
270
|
+
self.base_tooling_url
|
|
271
|
+
+ "query/?q=SELECT+SymbolTable+FROM+ApexClass+WHERE+Name%3D%27TestClass_TEST%27"
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
responses.add(responses.GET, url, json={"records": []})
|
|
275
|
+
|
|
276
|
+
def _mock_tests_complete(self, job_id="JOB_ID1234567"):
|
|
277
|
+
url = self.base_tooling_url + "query/"
|
|
278
|
+
query_string = (
|
|
279
|
+
"q=SELECT+Id%2C+Status%2C+"
|
|
280
|
+
+ "ApexClassId+FROM+ApexTestQueueItem+WHERE+ParentJobId+%3D+%27"
|
|
281
|
+
+ "{}%27".format(job_id)
|
|
282
|
+
)
|
|
283
|
+
expected_response = {
|
|
284
|
+
"done": True,
|
|
285
|
+
"totalSize": 1,
|
|
286
|
+
"records": [{"Status": "Completed"}],
|
|
287
|
+
}
|
|
288
|
+
responses.add(
|
|
289
|
+
responses.GET,
|
|
290
|
+
url,
|
|
291
|
+
match=[query_string_matcher(query_string)],
|
|
292
|
+
json=expected_response,
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
def _mock_tests_processing(self, job_id="JOB_ID1234567"):
|
|
296
|
+
url = self.base_tooling_url + "query/"
|
|
297
|
+
query_string = (
|
|
298
|
+
"q=SELECT+Id%2C+Status%2C+"
|
|
299
|
+
+ "ApexClassId+FROM+ApexTestQueueItem+WHERE+ParentJobId+%3D+%27"
|
|
300
|
+
+ f"{job_id}%27"
|
|
301
|
+
)
|
|
302
|
+
expected_response = {
|
|
303
|
+
"done": True,
|
|
304
|
+
"totalSize": 1,
|
|
305
|
+
"records": [{"Status": "Processing", "ApexClassId": 1}],
|
|
306
|
+
}
|
|
307
|
+
responses.add(
|
|
308
|
+
responses.GET,
|
|
309
|
+
url,
|
|
310
|
+
match=[query_string_matcher(query_string)],
|
|
311
|
+
json=expected_response,
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
def _mock_run_tests(self, success=True, body="JOB_ID1234567"):
|
|
315
|
+
url = self.base_tooling_url + "runTestsAsynchronous"
|
|
316
|
+
if success:
|
|
317
|
+
responses.add(responses.POST, url, json=body)
|
|
318
|
+
else:
|
|
319
|
+
responses.add(responses.POST, url, status=http.client.SERVICE_UNAVAILABLE)
|
|
320
|
+
|
|
321
|
+
def _mock_get_installpkg_results(self, records=[]):
|
|
322
|
+
url = self.base_tooling_url + "query/"
|
|
323
|
+
query_string = (
|
|
324
|
+
"q=SELECT+SubscriberPackage.Id%2C+SubscriberPackage.Name%2C+SubscriberPackage.NamespacePrefix%2C+"
|
|
325
|
+
"SubscriberPackageVersionId+FROM+InstalledSubscriberPackage"
|
|
326
|
+
)
|
|
327
|
+
responses.add(
|
|
328
|
+
responses.GET,
|
|
329
|
+
url,
|
|
330
|
+
match=[query_string_matcher(query_string)],
|
|
331
|
+
json={"totalSize": len(records), "records": records},
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
def _mock_api_version_discovery(self, org_config=None):
|
|
335
|
+
org_config = self.org_config if org_config is None else org_config
|
|
336
|
+
url = f"{org_config.instance_url}/services/data"
|
|
337
|
+
responses.add(responses.GET, url, json=[{"version": f"{self.api_version}"}])
|
|
338
|
+
|
|
339
|
+
@responses.activate
|
|
340
|
+
def test_run_task(self):
|
|
341
|
+
self._mock_api_version_discovery()
|
|
342
|
+
self._mock_apex_class_query()
|
|
343
|
+
self._mock_run_tests()
|
|
344
|
+
self._mock_get_failed_test_classes()
|
|
345
|
+
self._mock_tests_complete()
|
|
346
|
+
self._mock_get_test_results()
|
|
347
|
+
self._mock_get_installpkg_results()
|
|
348
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
349
|
+
task()
|
|
350
|
+
assert len(responses.calls) == 7
|
|
351
|
+
|
|
352
|
+
@responses.activate
|
|
353
|
+
def test_run_task_None_methodname_fail(self):
|
|
354
|
+
self._mock_api_version_discovery()
|
|
355
|
+
self._mock_get_installpkg_results()
|
|
356
|
+
self._mock_apex_class_query()
|
|
357
|
+
self._mock_run_tests()
|
|
358
|
+
self._mock_get_failed_test_classes_failure()
|
|
359
|
+
self._mock_tests_complete()
|
|
360
|
+
self._mock_get_symboltable()
|
|
361
|
+
self._mock_get_test_results(methodname=[None], outcome="Fail")
|
|
362
|
+
self._mock_get_test_results(methodname=["test1"])
|
|
363
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
364
|
+
task()
|
|
365
|
+
assert task.counts["Retriable"] == 1
|
|
366
|
+
log = self._task_log_handler.messages
|
|
367
|
+
assert (
|
|
368
|
+
"Retrying class with id: 1 name:TestClass_TEST due to `None` methodname"
|
|
369
|
+
in log["info"]
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
@responses.activate
|
|
373
|
+
def test_run_task_None_methodname_pass(self):
|
|
374
|
+
self._mock_api_version_discovery()
|
|
375
|
+
self._mock_get_installpkg_results()
|
|
376
|
+
self._mock_apex_class_query()
|
|
377
|
+
self._mock_run_tests()
|
|
378
|
+
self._mock_get_failed_test_classes()
|
|
379
|
+
self._mock_tests_complete()
|
|
380
|
+
self._mock_get_symboltable()
|
|
381
|
+
self._mock_get_test_results(methodname=[None])
|
|
382
|
+
self._mock_get_test_results(methodname=["test1"])
|
|
383
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
384
|
+
task()
|
|
385
|
+
assert task.counts["Retriable"] == 1
|
|
386
|
+
log = self._task_log_handler.messages
|
|
387
|
+
assert (
|
|
388
|
+
"Retrying class with id: 1 name:TestClass_TEST due to `None` methodname"
|
|
389
|
+
in log["info"]
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
@responses.activate
|
|
393
|
+
def test_run_task__server_error(self):
|
|
394
|
+
self._mock_api_version_discovery()
|
|
395
|
+
self._mock_get_installpkg_results()
|
|
396
|
+
self._mock_apex_class_query()
|
|
397
|
+
self._mock_run_tests(success=False)
|
|
398
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
399
|
+
with pytest.raises(SalesforceGeneralError):
|
|
400
|
+
task()
|
|
401
|
+
|
|
402
|
+
@responses.activate
|
|
403
|
+
def test_run_task__failed(self):
|
|
404
|
+
self._mock_api_version_discovery()
|
|
405
|
+
self._mock_get_installpkg_results()
|
|
406
|
+
self._mock_apex_class_query()
|
|
407
|
+
self._mock_run_tests()
|
|
408
|
+
self._mock_get_failed_test_classes()
|
|
409
|
+
self._mock_tests_complete()
|
|
410
|
+
self._mock_get_test_results("Fail")
|
|
411
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
412
|
+
with pytest.raises(ApexTestException):
|
|
413
|
+
task()
|
|
414
|
+
|
|
415
|
+
@responses.activate
|
|
416
|
+
def test_run_task__failed_class_level(self):
|
|
417
|
+
self._mock_api_version_discovery()
|
|
418
|
+
self._mock_get_installpkg_results()
|
|
419
|
+
self._mock_apex_class_query()
|
|
420
|
+
self._mock_run_tests()
|
|
421
|
+
self._mock_get_failed_test_classes_failure()
|
|
422
|
+
self._mock_tests_complete()
|
|
423
|
+
self._mock_get_test_results()
|
|
424
|
+
self._mock_get_symboltable()
|
|
425
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
426
|
+
with pytest.raises(ApexTestException):
|
|
427
|
+
task()
|
|
428
|
+
|
|
429
|
+
@responses.activate
|
|
430
|
+
def test_run_task__failed_class_level_no_symboltable(self):
|
|
431
|
+
self._mock_api_version_discovery()
|
|
432
|
+
self._mock_get_installpkg_results()
|
|
433
|
+
self._mock_apex_class_query()
|
|
434
|
+
self._mock_run_tests()
|
|
435
|
+
self._mock_get_failed_test_classes_failure()
|
|
436
|
+
self._mock_tests_complete()
|
|
437
|
+
self._mock_get_test_results()
|
|
438
|
+
self._mock_get_symboltable_failure()
|
|
439
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
440
|
+
with pytest.raises(CumulusCIException):
|
|
441
|
+
task()
|
|
442
|
+
|
|
443
|
+
@responses.activate
|
|
444
|
+
def test_run_task__failed_class_level_no_symboltable__spring20_managed(self):
|
|
445
|
+
self._mock_apex_class_query(name="ns__Test_TEST", namespace="ns")
|
|
446
|
+
self._mock_run_tests()
|
|
447
|
+
self._mock_get_failed_test_classes_failure()
|
|
448
|
+
self._mock_tests_complete()
|
|
449
|
+
self._mock_get_test_results()
|
|
450
|
+
self._mock_get_symboltable_failure()
|
|
451
|
+
task_config = TaskConfig()
|
|
452
|
+
task_config.config["options"] = {
|
|
453
|
+
"junit_output": "results_junit.xml",
|
|
454
|
+
"poll_interval": 1,
|
|
455
|
+
"test_name_match": "%_TEST",
|
|
456
|
+
"managed": True,
|
|
457
|
+
"namespace": "ns",
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
461
|
+
task._get_test_methods_for_class = Mock()
|
|
462
|
+
|
|
463
|
+
task()
|
|
464
|
+
|
|
465
|
+
task._get_test_methods_for_class.assert_not_called()
|
|
466
|
+
|
|
467
|
+
@responses.activate
|
|
468
|
+
def test_run_task__retry_tests(self):
|
|
469
|
+
self._mock_api_version_discovery()
|
|
470
|
+
self._mock_get_installpkg_results()
|
|
471
|
+
self._mock_apex_class_query()
|
|
472
|
+
self._mock_run_tests()
|
|
473
|
+
self._mock_run_tests(body="JOBID_9999")
|
|
474
|
+
self._mock_get_failed_test_classes()
|
|
475
|
+
self._mock_get_failed_test_classes(job_id="JOBID_9999")
|
|
476
|
+
self._mock_tests_complete()
|
|
477
|
+
self._mock_tests_complete(job_id="JOBID_9999")
|
|
478
|
+
self._mock_get_test_results("Fail", "UNABLE_TO_LOCK_ROW")
|
|
479
|
+
self._mock_get_test_results(job_id="JOBID_9999")
|
|
480
|
+
|
|
481
|
+
task_config = TaskConfig()
|
|
482
|
+
task_config.config["options"] = {
|
|
483
|
+
"junit_output": "results_junit.xml",
|
|
484
|
+
"poll_interval": 1,
|
|
485
|
+
"test_name_match": "%_TEST",
|
|
486
|
+
"retry_failures": ["UNABLE_TO_LOCK_ROW"],
|
|
487
|
+
}
|
|
488
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
489
|
+
task()
|
|
490
|
+
assert len(responses.calls) == 11
|
|
491
|
+
|
|
492
|
+
@responses.activate
|
|
493
|
+
def test_run_task__retry_tests_with_retry_always(self):
|
|
494
|
+
self._mock_api_version_discovery()
|
|
495
|
+
self._mock_get_installpkg_results()
|
|
496
|
+
self._mock_apex_class_query()
|
|
497
|
+
self._mock_run_tests()
|
|
498
|
+
self._mock_run_tests(body="JOBID_9999")
|
|
499
|
+
self._mock_run_tests(body="JOBID_9990")
|
|
500
|
+
self._mock_get_failed_test_classes()
|
|
501
|
+
self._mock_get_failed_test_classes(job_id="JOBID_9999")
|
|
502
|
+
self._mock_get_failed_test_classes(job_id="JOBID_9990")
|
|
503
|
+
self._mock_tests_complete()
|
|
504
|
+
self._mock_tests_complete(job_id="JOBID_9999")
|
|
505
|
+
self._mock_tests_complete(job_id="JOBID_9990")
|
|
506
|
+
self._mock_get_test_results_multiple(
|
|
507
|
+
["TestOne", "TestTwo"],
|
|
508
|
+
["Fail", "Fail"],
|
|
509
|
+
["UNABLE_TO_LOCK_ROW", "LimitException"],
|
|
510
|
+
)
|
|
511
|
+
self._mock_get_test_results_multiple(
|
|
512
|
+
["TestOne"], ["Pass"], [""], job_id="JOBID_9999"
|
|
513
|
+
)
|
|
514
|
+
self._mock_get_test_results_multiple(
|
|
515
|
+
["TestTwo"], ["Fail"], ["LimitException"], job_id="JOBID_9990"
|
|
516
|
+
)
|
|
517
|
+
task_config = TaskConfig()
|
|
518
|
+
task_config.config["options"] = {
|
|
519
|
+
"junit_output": "results_junit.xml",
|
|
520
|
+
"poll_interval": 1,
|
|
521
|
+
"test_name_match": "%_TEST",
|
|
522
|
+
"retry_failures": ["UNABLE_TO_LOCK_ROW"],
|
|
523
|
+
"retry_always": True,
|
|
524
|
+
}
|
|
525
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
526
|
+
with pytest.raises(ApexTestException):
|
|
527
|
+
task()
|
|
528
|
+
|
|
529
|
+
@responses.activate
|
|
530
|
+
def test_run_task__retry_tests_fails(self):
|
|
531
|
+
self._mock_api_version_discovery()
|
|
532
|
+
self._mock_get_installpkg_results()
|
|
533
|
+
self._mock_apex_class_query()
|
|
534
|
+
self._mock_run_tests()
|
|
535
|
+
self._mock_run_tests(body="JOBID_9999")
|
|
536
|
+
self._mock_get_failed_test_classes()
|
|
537
|
+
self._mock_get_failed_test_classes(job_id="JOBID_9999")
|
|
538
|
+
self._mock_tests_complete()
|
|
539
|
+
self._mock_tests_complete(job_id="JOBID_9999")
|
|
540
|
+
self._mock_get_test_results("Fail", "UNABLE_TO_LOCK_ROW")
|
|
541
|
+
self._mock_get_test_results("Fail", "DUPLICATES_DETECTED", job_id="JOBID_9999")
|
|
542
|
+
|
|
543
|
+
task_config = TaskConfig()
|
|
544
|
+
task_config.config["options"] = {
|
|
545
|
+
"junit_output": "results_junit.xml",
|
|
546
|
+
"poll_interval": 1,
|
|
547
|
+
"test_name_match": "%_TEST",
|
|
548
|
+
"retry_failures": ["UNABLE_TO_LOCK_ROW"],
|
|
549
|
+
}
|
|
550
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
551
|
+
with pytest.raises(ApexTestException):
|
|
552
|
+
task()
|
|
553
|
+
|
|
554
|
+
@responses.activate
|
|
555
|
+
def test_run_task__processing(self):
|
|
556
|
+
self._mock_api_version_discovery()
|
|
557
|
+
self._mock_get_installpkg_results()
|
|
558
|
+
self._mock_apex_class_query()
|
|
559
|
+
self._mock_run_tests()
|
|
560
|
+
self._mock_tests_processing()
|
|
561
|
+
self._mock_get_failed_test_classes()
|
|
562
|
+
self._mock_tests_complete()
|
|
563
|
+
self._mock_get_test_results()
|
|
564
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
565
|
+
task()
|
|
566
|
+
log = self._task_log_handler.messages
|
|
567
|
+
assert "Completed: 0 Processing: 1 (TestClass_TEST) Queued: 0" in log["info"]
|
|
568
|
+
|
|
569
|
+
@responses.activate
|
|
570
|
+
def test_run_task__not_verbose(self):
|
|
571
|
+
self._mock_api_version_discovery()
|
|
572
|
+
self._mock_get_installpkg_results()
|
|
573
|
+
self._mock_apex_class_query()
|
|
574
|
+
self._mock_run_tests()
|
|
575
|
+
self._mock_tests_processing()
|
|
576
|
+
self._mock_get_failed_test_classes() # this returns all passes
|
|
577
|
+
self._mock_tests_complete()
|
|
578
|
+
self._mock_get_test_results()
|
|
579
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
580
|
+
task()
|
|
581
|
+
log = self._task_log_handler.messages
|
|
582
|
+
assert "Class: TestClass_TEST" not in log["info"]
|
|
583
|
+
|
|
584
|
+
@responses.activate
|
|
585
|
+
def test_run_task__verbose(self):
|
|
586
|
+
self._mock_api_version_discovery()
|
|
587
|
+
self._mock_get_installpkg_results()
|
|
588
|
+
self._mock_apex_class_query()
|
|
589
|
+
self._mock_run_tests()
|
|
590
|
+
self._mock_get_failed_test_classes_failure()
|
|
591
|
+
self._mock_tests_complete()
|
|
592
|
+
self._mock_get_test_results()
|
|
593
|
+
self._mock_get_symboltable()
|
|
594
|
+
task_config = TaskConfig()
|
|
595
|
+
task_config.config["options"] = {
|
|
596
|
+
"verbose": True,
|
|
597
|
+
"junit_output": "results_junit.xml",
|
|
598
|
+
"poll_interval": 1,
|
|
599
|
+
"test_name_match": "%_TEST",
|
|
600
|
+
}
|
|
601
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
602
|
+
with pytest.raises(CumulusCIException):
|
|
603
|
+
task()
|
|
604
|
+
log = self._task_log_handler.messages
|
|
605
|
+
assert "Class: TestClass_TEST" in log["info"]
|
|
606
|
+
|
|
607
|
+
@responses.activate
|
|
608
|
+
def test_run_task__no_code_coverage(self):
|
|
609
|
+
self._mock_api_version_discovery()
|
|
610
|
+
self._mock_get_installpkg_results()
|
|
611
|
+
self._mock_apex_class_query()
|
|
612
|
+
self._mock_run_tests()
|
|
613
|
+
self._mock_get_failed_test_classes()
|
|
614
|
+
self._mock_tests_complete()
|
|
615
|
+
self._mock_get_test_results()
|
|
616
|
+
task_config = TaskConfig()
|
|
617
|
+
task_config.config["options"] = {
|
|
618
|
+
"junit_output": "results_junit.xml",
|
|
619
|
+
"poll_interval": 1,
|
|
620
|
+
"test_name_match": "%_TEST",
|
|
621
|
+
}
|
|
622
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
623
|
+
task._check_code_coverage = Mock()
|
|
624
|
+
task()
|
|
625
|
+
task._check_code_coverage.assert_not_called()
|
|
626
|
+
|
|
627
|
+
@responses.activate
|
|
628
|
+
def test_run_task__checks_code_coverage(self):
|
|
629
|
+
self._mock_apex_class_query()
|
|
630
|
+
self._mock_run_tests()
|
|
631
|
+
self._mock_get_failed_test_classes()
|
|
632
|
+
self._mock_tests_complete()
|
|
633
|
+
self._mock_get_test_results()
|
|
634
|
+
task_config = TaskConfig()
|
|
635
|
+
task_config.config["options"] = {
|
|
636
|
+
"junit_output": "results_junit.xml",
|
|
637
|
+
"poll_interval": 1,
|
|
638
|
+
"test_name_match": "%_TEST",
|
|
639
|
+
"required_org_code_coverage_percent": "90",
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
org_config = OrgConfig(
|
|
643
|
+
{
|
|
644
|
+
"id": "foo/1",
|
|
645
|
+
"instance_url": "https://example.com",
|
|
646
|
+
"access_token": "abc123",
|
|
647
|
+
},
|
|
648
|
+
"test",
|
|
649
|
+
)
|
|
650
|
+
org_config._installed_packages = {"TEST": StrictVersion("1.2.3")}
|
|
651
|
+
task = RunApexTests(self.project_config, task_config, org_config)
|
|
652
|
+
task._check_code_coverage = Mock()
|
|
653
|
+
task()
|
|
654
|
+
task._check_code_coverage.assert_called_once()
|
|
655
|
+
|
|
656
|
+
def test_code_coverage_integer(self):
|
|
657
|
+
task_config = TaskConfig()
|
|
658
|
+
task_config.config["options"] = {
|
|
659
|
+
"junit_output": "results_junit.xml",
|
|
660
|
+
"poll_interval": 1,
|
|
661
|
+
"test_name_match": "%_TEST",
|
|
662
|
+
"required_org_code_coverage_percent": 90,
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
org_config = OrgConfig(
|
|
666
|
+
{
|
|
667
|
+
"id": "foo/1",
|
|
668
|
+
"instance_url": "https://example.com",
|
|
669
|
+
"access_token": "abc123",
|
|
670
|
+
},
|
|
671
|
+
"test",
|
|
672
|
+
)
|
|
673
|
+
task = RunApexTests(self.project_config, task_config, org_config)
|
|
674
|
+
|
|
675
|
+
assert task.code_coverage_level == 90
|
|
676
|
+
|
|
677
|
+
def test_code_coverage_percentage(self):
|
|
678
|
+
task_config = TaskConfig()
|
|
679
|
+
task_config.config["options"] = {
|
|
680
|
+
"junit_output": "results_junit.xml",
|
|
681
|
+
"poll_interval": 1,
|
|
682
|
+
"test_name_match": "%_TEST",
|
|
683
|
+
"required_org_code_coverage_percent": "90%",
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
org_config = OrgConfig(
|
|
687
|
+
{
|
|
688
|
+
"id": "foo/1",
|
|
689
|
+
"instance_url": "https://example.com",
|
|
690
|
+
"access_token": "abc123",
|
|
691
|
+
},
|
|
692
|
+
"test",
|
|
693
|
+
)
|
|
694
|
+
task = RunApexTests(self.project_config, task_config, org_config)
|
|
695
|
+
|
|
696
|
+
assert task.code_coverage_level == 90
|
|
697
|
+
|
|
698
|
+
def test_exception_bad_code_coverage(self):
|
|
699
|
+
task_config = TaskConfig()
|
|
700
|
+
task_config.config["options"] = {
|
|
701
|
+
"junit_output": "results_junit.xml",
|
|
702
|
+
"poll_interval": 1,
|
|
703
|
+
"test_name_match": "%_TEST",
|
|
704
|
+
"required_org_code_coverage_percent": "foo",
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
with pytest.raises(TaskOptionsError):
|
|
708
|
+
RunApexTests(self.project_config, task_config, self.org_config)
|
|
709
|
+
|
|
710
|
+
@responses.activate
|
|
711
|
+
def test_run_task__code_coverage_managed(self):
|
|
712
|
+
self._mock_apex_class_query(
|
|
713
|
+
namespace="TEST"
|
|
714
|
+
) # Query for TEST namespace (managed)
|
|
715
|
+
self._mock_run_tests()
|
|
716
|
+
self._mock_get_failed_test_classes()
|
|
717
|
+
self._mock_tests_complete()
|
|
718
|
+
self._mock_get_test_results()
|
|
719
|
+
task_config = TaskConfig()
|
|
720
|
+
task_config.config["options"] = {
|
|
721
|
+
"junit_output": "results_junit.xml",
|
|
722
|
+
"poll_interval": 1,
|
|
723
|
+
"test_name_match": "%_TEST",
|
|
724
|
+
"namespace": "TEST",
|
|
725
|
+
"required_org_code_coverage_percent": "90",
|
|
726
|
+
}
|
|
727
|
+
org_config = OrgConfig(
|
|
728
|
+
{
|
|
729
|
+
"id": "foo/1",
|
|
730
|
+
"instance_url": "https://example.com",
|
|
731
|
+
"access_token": "abc123",
|
|
732
|
+
},
|
|
733
|
+
"test",
|
|
734
|
+
)
|
|
735
|
+
org_config._installed_packages = {"TEST": StrictVersion("1.2.3")}
|
|
736
|
+
|
|
737
|
+
task = RunApexTests(self.project_config, task_config, org_config)
|
|
738
|
+
task._check_code_coverage = Mock()
|
|
739
|
+
task()
|
|
740
|
+
task._check_code_coverage.assert_not_called()
|
|
741
|
+
|
|
742
|
+
def test_check_code_coverage(self):
|
|
743
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
744
|
+
task.code_coverage_level = 90
|
|
745
|
+
task.tooling = Mock()
|
|
746
|
+
task.tooling.query.return_value = {
|
|
747
|
+
"records": [{"PercentCovered": 90}],
|
|
748
|
+
"totalSize": 1,
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
task._check_code_coverage()
|
|
752
|
+
task.tooling.query.assert_called_once_with(
|
|
753
|
+
"SELECT PercentCovered FROM ApexOrgWideCoverage"
|
|
754
|
+
)
|
|
755
|
+
|
|
756
|
+
def test_check_code_coverage__fail(self):
|
|
757
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
758
|
+
task.code_coverage_level = 90
|
|
759
|
+
task.tooling = Mock()
|
|
760
|
+
task.tooling.query.return_value = {
|
|
761
|
+
"records": [{"PercentCovered": 89}],
|
|
762
|
+
"totalSize": 1,
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
with pytest.raises(ApexTestException):
|
|
766
|
+
task._check_code_coverage()
|
|
767
|
+
|
|
768
|
+
def test_is_retriable_failure(self):
|
|
769
|
+
task_config = TaskConfig()
|
|
770
|
+
task_config.config["options"] = {
|
|
771
|
+
"junit_output": "results_junit.xml",
|
|
772
|
+
"poll_interval": 1,
|
|
773
|
+
"test_name_match": "%_TEST",
|
|
774
|
+
"retry_failures": [
|
|
775
|
+
"UNABLE_TO_LOCK_ROW",
|
|
776
|
+
"unable to obtain exclusive access to this record",
|
|
777
|
+
],
|
|
778
|
+
}
|
|
779
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
780
|
+
task._init_options(task_config.config["options"])
|
|
781
|
+
|
|
782
|
+
assert task._is_retriable_failure(
|
|
783
|
+
{
|
|
784
|
+
"Message": "UNABLE_TO_LOCK_ROW",
|
|
785
|
+
"StackTrace": "test",
|
|
786
|
+
"Outcome": "Fail",
|
|
787
|
+
}
|
|
788
|
+
)
|
|
789
|
+
assert task._is_retriable_failure(
|
|
790
|
+
{
|
|
791
|
+
"Message": "TEST",
|
|
792
|
+
"StackTrace": "unable to obtain exclusive access to this record",
|
|
793
|
+
"Outcome": "Fail",
|
|
794
|
+
}
|
|
795
|
+
)
|
|
796
|
+
assert not task._is_retriable_failure(
|
|
797
|
+
{
|
|
798
|
+
"Message": "DUPLICATES_DETECTED",
|
|
799
|
+
"StackTrace": "test",
|
|
800
|
+
"Outcome": "Fail",
|
|
801
|
+
}
|
|
802
|
+
)
|
|
803
|
+
|
|
804
|
+
def test_init_options__regexes(self):
|
|
805
|
+
task_config = TaskConfig()
|
|
806
|
+
task_config.config["options"] = {
|
|
807
|
+
"junit_output": "results_junit.xml",
|
|
808
|
+
"poll_interval": 1,
|
|
809
|
+
"test_name_match": "%_TEST",
|
|
810
|
+
"retry_failures": ["UNABLE_TO_LOCK_ROW"],
|
|
811
|
+
}
|
|
812
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
813
|
+
task._init_options(task_config.config["options"])
|
|
814
|
+
|
|
815
|
+
assert (
|
|
816
|
+
task.options["retry_failures"][0].search("UNABLE_TO_LOCK_ROW: test failed")
|
|
817
|
+
is not None
|
|
818
|
+
)
|
|
819
|
+
|
|
820
|
+
def test_init_options__bad_regexes(self):
|
|
821
|
+
task_config = TaskConfig()
|
|
822
|
+
task_config.config["options"] = {
|
|
823
|
+
"junit_output": "results_junit.xml",
|
|
824
|
+
"poll_interval": 1,
|
|
825
|
+
"test_name_match": "%_TEST",
|
|
826
|
+
"retry_failures": ["("],
|
|
827
|
+
}
|
|
828
|
+
with pytest.raises(TaskOptionsError):
|
|
829
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
830
|
+
task._init_options(task_config.config["options"])
|
|
831
|
+
|
|
832
|
+
def test_get_test_suite_ids_from_test_suite_names_query__multiple_test_suites(self):
|
|
833
|
+
# Test to ensure that query to fetch test suite ids from test suite names is formed properly when multiple test suites are specified.
|
|
834
|
+
task_config = TaskConfig(
|
|
835
|
+
{
|
|
836
|
+
"options": {
|
|
837
|
+
"test_suite_names": "TestSuite1,TestSuite2",
|
|
838
|
+
"test_name_match": "%_TEST%",
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
)
|
|
842
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
843
|
+
test_suite_names_arg = "TestSuite1,TestSuite2"
|
|
844
|
+
query = task._get_test_suite_ids_from_test_suite_names_query(
|
|
845
|
+
test_suite_names_arg
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
assert (
|
|
849
|
+
"SELECT Id, TestSuiteName FROM ApexTestSuite WHERE TestSuiteName IN ('TestSuite1','TestSuite2')"
|
|
850
|
+
== query
|
|
851
|
+
)
|
|
852
|
+
|
|
853
|
+
def test_get_test_suite_ids_from_test_suite_names_query__single_test_suite(self):
|
|
854
|
+
# Test to ensure that query to fetch test suite ids from test suite names is formed properly when a single test suite is specified.
|
|
855
|
+
|
|
856
|
+
task_config = TaskConfig(
|
|
857
|
+
{
|
|
858
|
+
"options": {
|
|
859
|
+
"test_suite_names": "TestSuite1",
|
|
860
|
+
"test_name_match": "%_TEST%",
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
test_suite_names_arg = "TestSuite1"
|
|
865
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
866
|
+
query = task._get_test_suite_ids_from_test_suite_names_query(
|
|
867
|
+
test_suite_names_arg
|
|
868
|
+
)
|
|
869
|
+
|
|
870
|
+
assert (
|
|
871
|
+
"SELECT Id, TestSuiteName FROM ApexTestSuite WHERE TestSuiteName IN ('TestSuite1')"
|
|
872
|
+
== query
|
|
873
|
+
)
|
|
874
|
+
|
|
875
|
+
def test_get_test_classes_from_test_suite_ids_query__no_test_name_exclude(self):
|
|
876
|
+
# Test to ensure that query to fetch test classes from test suite ids is formed properly when no test_name_exclude is specified.
|
|
877
|
+
task_config = TaskConfig()
|
|
878
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
879
|
+
test_suite_ids = ["id1", "id2"]
|
|
880
|
+
query = task._get_test_classes_from_test_suite_ids_query(test_suite_ids)
|
|
881
|
+
assert (
|
|
882
|
+
"SELECT Id, Name FROM ApexClass WHERE Id IN (SELECT ApexClassId FROM TestSuiteMembership WHERE ApexTestSuiteId IN ('id1','id2')) "
|
|
883
|
+
== query
|
|
884
|
+
)
|
|
885
|
+
|
|
886
|
+
def test_get_test_classes_from_test_suite_ids_query__with_test_name_exclude(self):
|
|
887
|
+
# Test to ensure that query to fetch test classes from test suite ids is formed properly when test_name_exclude is specified.
|
|
888
|
+
task_config = TaskConfig({"options": {"test_name_exclude": "Test1,Test2"}})
|
|
889
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
890
|
+
test_suite_ids = ["id1", "id2"]
|
|
891
|
+
query = task._get_test_classes_from_test_suite_ids_query(test_suite_ids)
|
|
892
|
+
assert (
|
|
893
|
+
"SELECT Id, Name FROM ApexClass WHERE Id IN (SELECT ApexClassId FROM TestSuiteMembership WHERE ApexTestSuiteId IN ('id1','id2')) AND Name NOT IN ('Test1','Test2')"
|
|
894
|
+
== query
|
|
895
|
+
)
|
|
896
|
+
|
|
897
|
+
def test_get_comma_separated_string_of_items__multiple_items(self):
|
|
898
|
+
# Test to ensure that a comma separated string of items is properly formed when a list of strings with multiple strings is passed.
|
|
899
|
+
task_config = TaskConfig()
|
|
900
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
901
|
+
itemlist = ["TestSuite1", "TestSuite2"]
|
|
902
|
+
item_string = task._get_comma_separated_string_of_items(itemlist)
|
|
903
|
+
assert item_string == "'TestSuite1','TestSuite2'"
|
|
904
|
+
|
|
905
|
+
def test_get_comma_separated_string_of_items__single_item(self):
|
|
906
|
+
# Test to ensure that a comma separated string of items is properly formed when a list of strings with a single string is passed.
|
|
907
|
+
task_config = TaskConfig()
|
|
908
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
909
|
+
itemlist = ["TestSuite1"]
|
|
910
|
+
item_string = task._get_comma_separated_string_of_items(itemlist)
|
|
911
|
+
assert item_string == "'TestSuite1'"
|
|
912
|
+
|
|
913
|
+
def test_init_options__test_suite_names_and_test_name_match_provided(self):
|
|
914
|
+
# Test to ensure that a TaskOptionsError is raised when both test_suite_names and test_name_match are provided.
|
|
915
|
+
task_config = TaskConfig(
|
|
916
|
+
{
|
|
917
|
+
"options": {
|
|
918
|
+
"test_name_match": "sample",
|
|
919
|
+
"test_suite_names": "suite1,suite2",
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
)
|
|
923
|
+
with pytest.raises(TaskOptionsError):
|
|
924
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
925
|
+
task._init_options(task_config.config["options"])
|
|
926
|
+
|
|
927
|
+
def test_get_namespace_filter__managed(self):
|
|
928
|
+
task_config = TaskConfig({"options": {"managed": True, "namespace": "testns"}})
|
|
929
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
930
|
+
namespace = task._get_namespace_filter()
|
|
931
|
+
assert namespace == "'testns'"
|
|
932
|
+
|
|
933
|
+
def test_get_namespace_filter__target_org(self):
|
|
934
|
+
task_config = TaskConfig({"options": {}})
|
|
935
|
+
org_config = OrgConfig(
|
|
936
|
+
{
|
|
937
|
+
"id": "foo/1",
|
|
938
|
+
"instance_url": "https://example.com",
|
|
939
|
+
"access_token": "abc123",
|
|
940
|
+
"namespace": "testns",
|
|
941
|
+
},
|
|
942
|
+
"test",
|
|
943
|
+
)
|
|
944
|
+
task = RunApexTests(self.project_config, task_config, org_config)
|
|
945
|
+
namespace = task._get_namespace_filter()
|
|
946
|
+
assert namespace == "'testns'"
|
|
947
|
+
|
|
948
|
+
def test_get_namespace_filter__managed_no_namespace(self):
|
|
949
|
+
task_config = TaskConfig({"options": {"managed": True}})
|
|
950
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
951
|
+
with pytest.raises(TaskOptionsError):
|
|
952
|
+
task._get_namespace_filter()
|
|
953
|
+
|
|
954
|
+
def test_get_test_class_query__exclude(self):
|
|
955
|
+
task_config = TaskConfig(
|
|
956
|
+
{"options": {"test_name_match": "%_TEST", "test_name_exclude": "EXCL"}}
|
|
957
|
+
)
|
|
958
|
+
task = RunApexTests(self.project_config, task_config, self.org_config)
|
|
959
|
+
query = task._get_test_class_query()
|
|
960
|
+
assert (
|
|
961
|
+
"SELECT Id, Name FROM ApexClass WHERE NamespacePrefix = null "
|
|
962
|
+
"AND (Name LIKE '%_TEST') AND (NOT Name LIKE 'EXCL')" == query
|
|
963
|
+
)
|
|
964
|
+
|
|
965
|
+
@responses.activate
|
|
966
|
+
def test_run_task__no_tests(self):
|
|
967
|
+
self._mock_api_version_discovery()
|
|
968
|
+
self._mock_get_installpkg_results()
|
|
969
|
+
task = RunApexTests(self.project_config, self.task_config, self.org_config)
|
|
970
|
+
task._get_test_classes = MagicMock(return_value={"totalSize": 0})
|
|
971
|
+
task()
|
|
972
|
+
assert task.result is None
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
@patch(
|
|
976
|
+
"cumulusci.core.tasks.BaseSalesforceTask._update_credentials",
|
|
977
|
+
MagicMock(return_value=None),
|
|
978
|
+
)
|
|
979
|
+
class TestAnonymousApexTask:
|
|
980
|
+
def setup_method(self):
|
|
981
|
+
self.api_version = 42.0
|
|
982
|
+
self.universal_config = UniversalConfig(
|
|
983
|
+
{"project": {"api_version": self.api_version}}
|
|
984
|
+
)
|
|
985
|
+
self.tmpdir = tempfile.mkdtemp(dir=".")
|
|
986
|
+
apex_path = os.path.join(self.tmpdir, "test.apex")
|
|
987
|
+
with open(apex_path, "w") as f:
|
|
988
|
+
f.write('System.debug("from file")')
|
|
989
|
+
self.task_config = TaskConfig()
|
|
990
|
+
self.task_config.config["options"] = {
|
|
991
|
+
"path": apex_path,
|
|
992
|
+
"apex": 'system.debug("Hello World!")',
|
|
993
|
+
"param1": "StringValue",
|
|
994
|
+
}
|
|
995
|
+
self.project_config = BaseProjectConfig(
|
|
996
|
+
self.universal_config, config={"noyaml": True}
|
|
997
|
+
)
|
|
998
|
+
self.project_config.config = {
|
|
999
|
+
"project": {
|
|
1000
|
+
"package": {"namespace": "abc", "api_version": self.api_version}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
keychain = BaseProjectKeychain(self.project_config, "")
|
|
1004
|
+
self.project_config.set_keychain(keychain)
|
|
1005
|
+
self.org_config = OrgConfig(
|
|
1006
|
+
{
|
|
1007
|
+
"id": "foo/1",
|
|
1008
|
+
"instance_url": "https://example.com",
|
|
1009
|
+
"access_token": "abc123",
|
|
1010
|
+
"namespace": "abc",
|
|
1011
|
+
},
|
|
1012
|
+
"test",
|
|
1013
|
+
)
|
|
1014
|
+
self.org_config._installed_packages = {}
|
|
1015
|
+
self.base_tooling_url = "{}/services/data/v{}/tooling/".format(
|
|
1016
|
+
self.org_config.instance_url, self.api_version
|
|
1017
|
+
)
|
|
1018
|
+
|
|
1019
|
+
def teardown_method(self):
|
|
1020
|
+
shutil.rmtree(self.tmpdir)
|
|
1021
|
+
|
|
1022
|
+
def _get_url_and_task(self):
|
|
1023
|
+
task = AnonymousApexTask(self.project_config, self.task_config, self.org_config)
|
|
1024
|
+
url = self.base_tooling_url + "executeAnonymous"
|
|
1025
|
+
return task, url
|
|
1026
|
+
|
|
1027
|
+
def test_validate_options(self):
|
|
1028
|
+
task_config = TaskConfig({})
|
|
1029
|
+
with pytest.raises(TaskOptionsError):
|
|
1030
|
+
AnonymousApexTask(self.project_config, task_config, self.org_config)
|
|
1031
|
+
|
|
1032
|
+
def test_run_from_path_outside_repo(self):
|
|
1033
|
+
task_config = TaskConfig({"options": {"path": "/"}})
|
|
1034
|
+
task = AnonymousApexTask(self.project_config, task_config, self.org_config)
|
|
1035
|
+
with pytest.raises(TaskOptionsError):
|
|
1036
|
+
task()
|
|
1037
|
+
|
|
1038
|
+
def test_run_path_not_found(self):
|
|
1039
|
+
task_config = TaskConfig({"options": {"path": "bogus"}})
|
|
1040
|
+
task = AnonymousApexTask(self.project_config, task_config, self.org_config)
|
|
1041
|
+
with pytest.raises(TaskOptionsError):
|
|
1042
|
+
task()
|
|
1043
|
+
|
|
1044
|
+
def test_prepare_apex(self):
|
|
1045
|
+
self.task_config.config["options"]["namespaced"] = True
|
|
1046
|
+
|
|
1047
|
+
task = AnonymousApexTask(self.project_config, self.task_config, self.org_config)
|
|
1048
|
+
before = "String %%%NAMESPACED_ORG%%%str = '%%%NAMESPACED_RT%%%';"
|
|
1049
|
+
expected = "String abc__str = 'abc.';"
|
|
1050
|
+
assert expected == task._prepare_apex(before)
|
|
1051
|
+
|
|
1052
|
+
def test_prepare_apex__detect_namespace(self):
|
|
1053
|
+
task = AnonymousApexTask(self.project_config, self.task_config, self.org_config)
|
|
1054
|
+
before = "String %%%NAMESPACED_ORG%%%str = '%%%NAMESPACED_RT%%%';"
|
|
1055
|
+
expected = "String abc__str = 'abc.';"
|
|
1056
|
+
assert expected == task._prepare_apex(before)
|
|
1057
|
+
|
|
1058
|
+
def test_optional_parameter_1_replacement(self):
|
|
1059
|
+
task = AnonymousApexTask(self.project_config, self.task_config, self.org_config)
|
|
1060
|
+
before = "String str = '%%%PARAM_1%%%';"
|
|
1061
|
+
expected = "String str = 'StringValue';"
|
|
1062
|
+
assert expected == task._prepare_apex(before)
|
|
1063
|
+
|
|
1064
|
+
def test_optional_parameter_2_replacement(self):
|
|
1065
|
+
task = AnonymousApexTask(self.project_config, self.task_config, self.org_config)
|
|
1066
|
+
before = "String str = '%%%PARAM_2%%%';"
|
|
1067
|
+
expected = "String str = '';"
|
|
1068
|
+
assert expected == task._prepare_apex(before)
|
|
1069
|
+
|
|
1070
|
+
@responses.activate
|
|
1071
|
+
def test_run_anonymous_apex_success(self):
|
|
1072
|
+
task, url = self._get_url_and_task()
|
|
1073
|
+
resp = {"compiled": True, "success": True}
|
|
1074
|
+
responses.add(responses.GET, url, status=200, json=resp)
|
|
1075
|
+
task()
|
|
1076
|
+
|
|
1077
|
+
@responses.activate
|
|
1078
|
+
def test_run_string_only(self):
|
|
1079
|
+
task_config = TaskConfig({"options": {"apex": 'System.debug("test");'}})
|
|
1080
|
+
task = AnonymousApexTask(self.project_config, task_config, self.org_config)
|
|
1081
|
+
url = self.base_tooling_url + "executeAnonymous"
|
|
1082
|
+
responses.add(
|
|
1083
|
+
responses.GET, url, status=200, json={"compiled": True, "success": True}
|
|
1084
|
+
)
|
|
1085
|
+
task()
|
|
1086
|
+
|
|
1087
|
+
@responses.activate
|
|
1088
|
+
def test_run_anonymous_apex_status_fail(self):
|
|
1089
|
+
task, url = self._get_url_and_task()
|
|
1090
|
+
responses.add(responses.GET, url, status=418, body="I'm a teapot")
|
|
1091
|
+
with pytest.raises(SalesforceGeneralError) as e:
|
|
1092
|
+
task()
|
|
1093
|
+
err = e.value
|
|
1094
|
+
assert str(err) == "Error Code 418. Response content: I'm a teapot"
|
|
1095
|
+
assert err.url.startswith(url)
|
|
1096
|
+
assert err.status == 418
|
|
1097
|
+
assert err.content == "I'm a teapot"
|
|
1098
|
+
|
|
1099
|
+
@responses.activate
|
|
1100
|
+
def test_run_anonymous_apex_compile_except(self):
|
|
1101
|
+
task, url = self._get_url_and_task()
|
|
1102
|
+
problem = "Unexpected token '('."
|
|
1103
|
+
resp = {
|
|
1104
|
+
"compiled": False,
|
|
1105
|
+
"compileProblem": problem,
|
|
1106
|
+
"success": False,
|
|
1107
|
+
"line": 1,
|
|
1108
|
+
"column": 13,
|
|
1109
|
+
"exceptionMessage": "",
|
|
1110
|
+
"exceptionStackTrace": "",
|
|
1111
|
+
"logs": "",
|
|
1112
|
+
}
|
|
1113
|
+
responses.add(responses.GET, url, status=200, json=resp)
|
|
1114
|
+
with pytest.raises(ApexCompilationException) as e:
|
|
1115
|
+
task()
|
|
1116
|
+
err = e.value
|
|
1117
|
+
assert err.args[0] == 1
|
|
1118
|
+
assert err.args[1] == problem
|
|
1119
|
+
|
|
1120
|
+
@responses.activate
|
|
1121
|
+
def test_run_anonymous_apex_except(self):
|
|
1122
|
+
task, url = self._get_url_and_task()
|
|
1123
|
+
problem = "Unexpected token '('."
|
|
1124
|
+
trace = "Line 0, Column 99"
|
|
1125
|
+
resp = {
|
|
1126
|
+
"compiled": True,
|
|
1127
|
+
"compileProblem": "",
|
|
1128
|
+
"success": False,
|
|
1129
|
+
"line": 1,
|
|
1130
|
+
"column": 13,
|
|
1131
|
+
"exceptionMessage": problem,
|
|
1132
|
+
"exceptionStackTrace": trace,
|
|
1133
|
+
"logs": "",
|
|
1134
|
+
}
|
|
1135
|
+
responses.add(responses.GET, url, status=200, json=resp)
|
|
1136
|
+
with pytest.raises(ApexException) as e:
|
|
1137
|
+
task()
|
|
1138
|
+
err = e.value
|
|
1139
|
+
assert err.args[0] == problem
|
|
1140
|
+
assert err.args[1] == trace
|
|
1141
|
+
|
|
1142
|
+
@responses.activate
|
|
1143
|
+
def test_run_anonymous_apex__gack(self):
|
|
1144
|
+
task, url = self._get_url_and_task()
|
|
1145
|
+
responses.add(responses.GET, url, status=200, body="null")
|
|
1146
|
+
with pytest.raises(SalesforceException) as e:
|
|
1147
|
+
task()
|
|
1148
|
+
err = str(e.value)
|
|
1149
|
+
assert "gack" in err
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
@patch(
|
|
1153
|
+
"cumulusci.core.tasks.BaseSalesforceTask._update_credentials",
|
|
1154
|
+
MagicMock(return_value=None),
|
|
1155
|
+
)
|
|
1156
|
+
class TestRunBatchApex(MockLoggerMixin):
|
|
1157
|
+
def setup_method(self):
|
|
1158
|
+
self.api_version = 42.0
|
|
1159
|
+
self.universal_config = UniversalConfig(
|
|
1160
|
+
{"project": {"api_version": self.api_version}}
|
|
1161
|
+
)
|
|
1162
|
+
self.task_config = TaskConfig()
|
|
1163
|
+
self.task_config.config["options"] = {
|
|
1164
|
+
"class_name": "ADDR_Seasonal_BATCH",
|
|
1165
|
+
"poll_interval": 1,
|
|
1166
|
+
}
|
|
1167
|
+
self.project_config = BaseProjectConfig(
|
|
1168
|
+
self.universal_config, config={"noyaml": True}
|
|
1169
|
+
)
|
|
1170
|
+
self.project_config.config["project"] = {
|
|
1171
|
+
"package": {"api_version": self.api_version}
|
|
1172
|
+
}
|
|
1173
|
+
keychain = BaseProjectKeychain(self.project_config, "")
|
|
1174
|
+
self.project_config.set_keychain(keychain)
|
|
1175
|
+
self.org_config = OrgConfig(
|
|
1176
|
+
{
|
|
1177
|
+
"id": "foo/1",
|
|
1178
|
+
"instance_url": "https://example.com",
|
|
1179
|
+
"access_token": "abc123",
|
|
1180
|
+
},
|
|
1181
|
+
"test",
|
|
1182
|
+
)
|
|
1183
|
+
self.base_tooling_url = "{}/services/data/v{}/tooling/".format(
|
|
1184
|
+
self.org_config.instance_url, self.api_version
|
|
1185
|
+
)
|
|
1186
|
+
self.task_log = self._task_log_handler.messages
|
|
1187
|
+
|
|
1188
|
+
def _get_query_resp(self):
|
|
1189
|
+
return {
|
|
1190
|
+
"size": 1,
|
|
1191
|
+
"totalSize": 1,
|
|
1192
|
+
"done": True,
|
|
1193
|
+
"queryLocator": None,
|
|
1194
|
+
"entityTypeName": "AsyncApexJob",
|
|
1195
|
+
"records": [
|
|
1196
|
+
{
|
|
1197
|
+
"attributes": {
|
|
1198
|
+
"type": "AsyncApexJob",
|
|
1199
|
+
"url": "/services/data/v43.0/tooling/sobjects/AsyncApexJob/707L0000014nnPHIAY",
|
|
1200
|
+
},
|
|
1201
|
+
"Id": "707L0000014nnPHIAY",
|
|
1202
|
+
"ApexClass": {
|
|
1203
|
+
"attributes": {
|
|
1204
|
+
"type": "ApexClass",
|
|
1205
|
+
"url": "/services/data/v43.0/tooling/sobjects/ApexClass/01pL000000109ndIAA",
|
|
1206
|
+
},
|
|
1207
|
+
"Name": "ADDR_Seasonal_BATCH",
|
|
1208
|
+
},
|
|
1209
|
+
"Status": "Completed",
|
|
1210
|
+
"ExtendedStatus": None,
|
|
1211
|
+
"TotalJobItems": 1,
|
|
1212
|
+
"JobItemsProcessed": 1,
|
|
1213
|
+
"NumberOfErrors": 0,
|
|
1214
|
+
"CreatedDate": "2018-08-07T16:00:56.000+0000",
|
|
1215
|
+
"CompletedDate": "2018-08-07T16:01:57.000+0000",
|
|
1216
|
+
}
|
|
1217
|
+
],
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
def _update_job_result(self, response: dict, result_dict: dict):
|
|
1221
|
+
"Extend the result from _get_query_resp with additional batch records"
|
|
1222
|
+
template_result = response["records"][-1] # use the last result as a template
|
|
1223
|
+
assert isinstance(template_result, dict)
|
|
1224
|
+
new_result = {**template_result, **result_dict} # copy with variations
|
|
1225
|
+
old_subjob_results = [ # set completed for all old subjob results
|
|
1226
|
+
{**record, "Status": "Completed"} for record in response["records"]
|
|
1227
|
+
]
|
|
1228
|
+
result_list = [
|
|
1229
|
+
new_result
|
|
1230
|
+
] + old_subjob_results # prepend new result because SOQL is order by DESC
|
|
1231
|
+
return {**response, "records": result_list}
|
|
1232
|
+
|
|
1233
|
+
def _get_url_and_task(self):
|
|
1234
|
+
task = BatchApexWait(self.project_config, self.task_config, self.org_config)
|
|
1235
|
+
url = (
|
|
1236
|
+
self.base_tooling_url
|
|
1237
|
+
+ "query/?q=SELECT+Id%2C+ApexClass.Name%2C+Status%2C+ExtendedStatus%2C+TotalJobItems%2C+JobItemsProcessed%2C+NumberOfErrors%2C+CreatedDate%2C+CompletedDate+FROM+AsyncApexJob+WHERE+JobType+IN+%28%27BatchApex%27%2C%27Queueable%27%29+AND+ApexClass.Name%3D%27ADDR_Seasonal_BATCH%27++++ORDER+BY+CreatedDate+DESC++LIMIT+1+"
|
|
1238
|
+
)
|
|
1239
|
+
return task, url
|
|
1240
|
+
|
|
1241
|
+
@responses.activate
|
|
1242
|
+
def test_run_batch_apex_status_fail(self):
|
|
1243
|
+
task, url = self._get_url_and_task()
|
|
1244
|
+
response = self._get_query_resp()
|
|
1245
|
+
response["records"][0]["NumberOfErrors"] = 1
|
|
1246
|
+
response["records"][0]["ExtendedStatus"] = "Bad Status"
|
|
1247
|
+
responses.add(responses.GET, url, json=response)
|
|
1248
|
+
with pytest.raises(SalesforceException) as e:
|
|
1249
|
+
task()
|
|
1250
|
+
err = e.value
|
|
1251
|
+
assert "Bad Status" in err.args[0]
|
|
1252
|
+
|
|
1253
|
+
@responses.activate
|
|
1254
|
+
def test_run_batch_apex_number_mismatch(self):
|
|
1255
|
+
task, url = self._get_url_and_task()
|
|
1256
|
+
response = self._get_query_resp()
|
|
1257
|
+
response["records"][0]["JobItemsProcessed"] = 1
|
|
1258
|
+
response["records"][0]["TotalJobItems"] = 3
|
|
1259
|
+
responses.add(responses.GET, url, json=response)
|
|
1260
|
+
task()
|
|
1261
|
+
|
|
1262
|
+
assert "The final record counts do not add up." in self.task_log["info"]
|
|
1263
|
+
|
|
1264
|
+
@responses.activate
|
|
1265
|
+
def test_run_batch_apex_status_ok(self):
|
|
1266
|
+
task, url = self._get_url_and_task()
|
|
1267
|
+
response = self._get_query_resp()
|
|
1268
|
+
responses.add(responses.GET, url, json=response)
|
|
1269
|
+
task()
|
|
1270
|
+
|
|
1271
|
+
@responses.activate
|
|
1272
|
+
def test_run_batch_apex_calc_elapsed_time(self):
|
|
1273
|
+
task, url = self._get_url_and_task()
|
|
1274
|
+
response = self._get_query_resp()
|
|
1275
|
+
responses.add(responses.GET, url, json=response)
|
|
1276
|
+
task()
|
|
1277
|
+
assert task.elapsed_time(task.subjobs) == 61
|
|
1278
|
+
|
|
1279
|
+
@responses.activate
|
|
1280
|
+
def test_run_batch_apex_queueable_status_failed(self):
|
|
1281
|
+
task, url = self._get_url_and_task()
|
|
1282
|
+
response = self._get_query_resp()
|
|
1283
|
+
response["records"][0]["JobType"] = "Queueable"
|
|
1284
|
+
response["records"][0]["Status"] = "Failed"
|
|
1285
|
+
response["records"][0]["JobItemsProcessed"] = 0
|
|
1286
|
+
response["records"][0]["TotalJobItems"] = 0
|
|
1287
|
+
response["records"][0]["ExtendedStatus"] = "Error Details"
|
|
1288
|
+
responses.add(responses.GET, url, json=response)
|
|
1289
|
+
with pytest.raises(SalesforceException) as e:
|
|
1290
|
+
task()
|
|
1291
|
+
assert "failure" in str(e.value)
|
|
1292
|
+
|
|
1293
|
+
@responses.activate
|
|
1294
|
+
def test_run_batch_apex_status_aborted(self):
|
|
1295
|
+
task, url = self._get_url_and_task()
|
|
1296
|
+
response = self._get_query_resp()
|
|
1297
|
+
response["records"][0]["Status"] = "Aborted"
|
|
1298
|
+
response["records"][0]["JobItemsProcessed"] = 1
|
|
1299
|
+
response["records"][0]["TotalJobItems"] = 3
|
|
1300
|
+
responses.add(responses.GET, url, json=response)
|
|
1301
|
+
with pytest.raises(SalesforceException) as e:
|
|
1302
|
+
task()
|
|
1303
|
+
assert "aborted" in str(e.value)
|
|
1304
|
+
|
|
1305
|
+
@responses.activate
|
|
1306
|
+
def test_run_batch_apex_status_failed(self):
|
|
1307
|
+
task, url = self._get_url_and_task()
|
|
1308
|
+
response = self._get_query_resp()
|
|
1309
|
+
response["records"][0]["Status"] = "Failed"
|
|
1310
|
+
response["records"][0]["JobItemsProcessed"] = 1
|
|
1311
|
+
response["records"][0]["TotalJobItems"] = 3
|
|
1312
|
+
responses.add(responses.GET, url, json=response)
|
|
1313
|
+
self.task_log["info"] = []
|
|
1314
|
+
with pytest.raises(SalesforceException) as e:
|
|
1315
|
+
task()
|
|
1316
|
+
assert "failure" in str(e.value)
|
|
1317
|
+
|
|
1318
|
+
@responses.activate
|
|
1319
|
+
def test_chained_subjobs(self):
|
|
1320
|
+
"Test subjobs that kick off a successor before they complete"
|
|
1321
|
+
task, url = self._get_url_and_task()
|
|
1322
|
+
url2 = (
|
|
1323
|
+
url.split("?")[0]
|
|
1324
|
+
+ "?q=SELECT+Id%2C+ApexClass.Name%2C+Status%2C+ExtendedStatus%2C+TotalJobItems%2C+JobItemsProcessed%2C+NumberOfErrors%2C+CreatedDate%2C+CompletedDate+FROM+AsyncApexJob+WHERE+JobType+IN+%28%27BatchApex%27%2C%27Queueable%27%29+AND+ApexClass.Name%3D%27ADDR_Seasonal_BATCH%27++AND+CreatedDate+%3E%3D+2018-08-07T16%3A00%3A00Z++ORDER+BY+CreatedDate+DESC++"
|
|
1325
|
+
)
|
|
1326
|
+
|
|
1327
|
+
# batch 1
|
|
1328
|
+
response = self._get_query_resp()
|
|
1329
|
+
batch_record = response["records"][0]
|
|
1330
|
+
batch_record.update(
|
|
1331
|
+
{
|
|
1332
|
+
"JobItemsProcessed": 1,
|
|
1333
|
+
"TotalJobItems": 3,
|
|
1334
|
+
"NumberOfErrors": 0,
|
|
1335
|
+
"Status": "Processing",
|
|
1336
|
+
"CreatedDate": "2018-08-07T16:00:00.000+0000",
|
|
1337
|
+
}
|
|
1338
|
+
)
|
|
1339
|
+
|
|
1340
|
+
responses.add(responses.GET, url, json=response)
|
|
1341
|
+
|
|
1342
|
+
# batch 2: 1 error
|
|
1343
|
+
response = self._update_job_result(
|
|
1344
|
+
response, {"Id": "Id2", "NumberOfErrors": 1, "Status": "Processing"}
|
|
1345
|
+
)
|
|
1346
|
+
responses.add(responses.GET, url2, json=response)
|
|
1347
|
+
|
|
1348
|
+
# batch 3: found another error
|
|
1349
|
+
response = self._update_job_result(
|
|
1350
|
+
response, {"Id": "Id2", "NumberOfErrors": 2, "Status": "Processing"}
|
|
1351
|
+
)
|
|
1352
|
+
responses.add(responses.GET, url2, json=response)
|
|
1353
|
+
|
|
1354
|
+
# batch 4: Complete, no errors in this sub-batch
|
|
1355
|
+
response = self._update_job_result(
|
|
1356
|
+
response,
|
|
1357
|
+
{
|
|
1358
|
+
"NumberOfErrors": 0,
|
|
1359
|
+
"Id": "Id4",
|
|
1360
|
+
"Status": "Completed",
|
|
1361
|
+
"CompletedDate": "2018-08-07T16:10:00.000+0000", # 10 minutes passed
|
|
1362
|
+
},
|
|
1363
|
+
)
|
|
1364
|
+
responses.add(responses.GET, url2, json=response.copy())
|
|
1365
|
+
|
|
1366
|
+
with pytest.raises(SalesforceException) as e:
|
|
1367
|
+
task()
|
|
1368
|
+
|
|
1369
|
+
assert len(task.subjobs) == 4
|
|
1370
|
+
summary = task.summarize_subjobs(task.subjobs)
|
|
1371
|
+
assert not summary["Success"]
|
|
1372
|
+
assert not summary["CountsAddUp"]
|
|
1373
|
+
assert summary["ElapsedTime"] == 10 * 60
|
|
1374
|
+
assert summary["JobItemsProcessed"] == 4
|
|
1375
|
+
assert summary["TotalJobItems"] == 12
|
|
1376
|
+
assert summary["NumberOfErrors"] == 3
|
|
1377
|
+
assert "batch errors" in str(e.value)
|
|
1378
|
+
|
|
1379
|
+
@responses.activate
|
|
1380
|
+
def test_chained_subjobs_beginning(self):
|
|
1381
|
+
"Test the first subjob that kicks off a successor before they complete"
|
|
1382
|
+
task, url = self._get_url_and_task()
|
|
1383
|
+
url2 = (
|
|
1384
|
+
url.split("?")[0]
|
|
1385
|
+
+ "?q=SELECT+Id%2C+ApexClass.Name%2C+Status%2C+ExtendedStatus%2C+TotalJobItems%2C+JobItemsProcessed%2C+NumberOfErrors%2C+CreatedDate%2C+CompletedDate+FROM+AsyncApexJob+WHERE+JobType+IN+%28%27BatchApex%27%2C%27Queueable%27%29+AND+ApexClass.Name%3D%27ADDR_Seasonal_BATCH%27++AND+CreatedDate+%3E%3D+2018-08-07T16%3A00%3A00Z++ORDER+BY+CreatedDate+DESC++"
|
|
1386
|
+
)
|
|
1387
|
+
|
|
1388
|
+
# batch 1
|
|
1389
|
+
response = self._get_query_resp()
|
|
1390
|
+
responses.add(responses.GET, url2, json=response)
|
|
1391
|
+
|
|
1392
|
+
batch_record = response["records"][0]
|
|
1393
|
+
batch_record.update(
|
|
1394
|
+
{
|
|
1395
|
+
"JobItemsProcessed": 1,
|
|
1396
|
+
"TotalJobItems": 3,
|
|
1397
|
+
"NumberOfErrors": 0,
|
|
1398
|
+
"Status": "Preparing",
|
|
1399
|
+
"CreatedDate": "2018-08-07T16:00:00.000+0000",
|
|
1400
|
+
"CompletedDate": None,
|
|
1401
|
+
}
|
|
1402
|
+
)
|
|
1403
|
+
|
|
1404
|
+
real_poll_action = task._poll_action
|
|
1405
|
+
counter = 0
|
|
1406
|
+
|
|
1407
|
+
def mock_poll_action():
|
|
1408
|
+
nonlocal counter
|
|
1409
|
+
counter += 1
|
|
1410
|
+
if counter == 1:
|
|
1411
|
+
task.poll_complete = False
|
|
1412
|
+
return real_poll_action()
|
|
1413
|
+
else:
|
|
1414
|
+
rc = real_poll_action()
|
|
1415
|
+
task.poll_complete = True
|
|
1416
|
+
return rc
|
|
1417
|
+
|
|
1418
|
+
task._poll_action = mock_poll_action
|
|
1419
|
+
|
|
1420
|
+
responses.add(responses.GET, url, json=response)
|
|
1421
|
+
|
|
1422
|
+
task()
|
|
1423
|
+
assert counter == 2
|
|
1424
|
+
assert task.poll_complete
|
|
1425
|
+
summary = task.summarize_subjobs(task.subjobs)
|
|
1426
|
+
assert not summary["NumberOfErrors"]
|
|
1427
|
+
|
|
1428
|
+
@responses.activate
|
|
1429
|
+
def test_chained_subjobs_halfway(self):
|
|
1430
|
+
"Test part-way through a series of subjobs that kick off a successor before they complete"
|
|
1431
|
+
task, url = self._get_url_and_task()
|
|
1432
|
+
url2 = (
|
|
1433
|
+
url.split("?")[0]
|
|
1434
|
+
+ "?q=SELECT+Id%2C+ApexClass.Name%2C+Status%2C+ExtendedStatus%2C+TotalJobItems%2C+JobItemsProcessed%2C+NumberOfErrors%2C+CreatedDate%2C+CompletedDate+FROM+AsyncApexJob+WHERE+JobType+IN+%28%27BatchApex%27%2C%27Queueable%27%29+AND+ApexClass.Name%3D%27ADDR_Seasonal_BATCH%27++AND+CreatedDate+%3E%3D+2018-08-07T16%3A00%3A00Z++ORDER+BY+CreatedDate+DESC++"
|
|
1435
|
+
)
|
|
1436
|
+
|
|
1437
|
+
# batch 1
|
|
1438
|
+
response = self._get_query_resp()
|
|
1439
|
+
responses.add(responses.GET, url2, json=response)
|
|
1440
|
+
|
|
1441
|
+
batch_record = response["records"][0]
|
|
1442
|
+
batch_record.update(
|
|
1443
|
+
{
|
|
1444
|
+
"JobItemsProcessed": 1,
|
|
1445
|
+
"TotalJobItems": 3,
|
|
1446
|
+
"NumberOfErrors": 0,
|
|
1447
|
+
"Status": "Preparing",
|
|
1448
|
+
"CreatedDate": "2018-08-07T16:00:00.000+0000",
|
|
1449
|
+
"CompletedDate": "2018-08-07T16:05:00.000+0000",
|
|
1450
|
+
}
|
|
1451
|
+
)
|
|
1452
|
+
|
|
1453
|
+
# batch 2: 1 error
|
|
1454
|
+
response = self._update_job_result(
|
|
1455
|
+
response, {"Id": "Id2", "NumberOfErrors": 1, "CompletedDate": None}
|
|
1456
|
+
)
|
|
1457
|
+
responses.add(responses.GET, url2, json=response)
|
|
1458
|
+
|
|
1459
|
+
real_poll_action = task._poll_action
|
|
1460
|
+
counter = 0
|
|
1461
|
+
|
|
1462
|
+
def mock_poll_action():
|
|
1463
|
+
nonlocal counter
|
|
1464
|
+
counter += 1
|
|
1465
|
+
if counter == 1:
|
|
1466
|
+
task.poll_complete = False
|
|
1467
|
+
return real_poll_action()
|
|
1468
|
+
else:
|
|
1469
|
+
rc = real_poll_action()
|
|
1470
|
+
task.poll_complete = True
|
|
1471
|
+
return rc
|
|
1472
|
+
|
|
1473
|
+
task._poll_action = mock_poll_action
|
|
1474
|
+
|
|
1475
|
+
responses.add(responses.GET, url, json=response)
|
|
1476
|
+
|
|
1477
|
+
task()
|
|
1478
|
+
assert counter == 2
|
|
1479
|
+
assert task.poll_complete
|
|
1480
|
+
summary = task.summarize_subjobs(task.subjobs)
|
|
1481
|
+
assert not summary["NumberOfErrors"]
|
|
1482
|
+
|
|
1483
|
+
@responses.activate
|
|
1484
|
+
def test_job_not_found(self):
|
|
1485
|
+
task, url = self._get_url_and_task()
|
|
1486
|
+
response = self._get_query_resp()
|
|
1487
|
+
response["records"] = []
|
|
1488
|
+
responses.add(responses.GET, url, json=response)
|
|
1489
|
+
|
|
1490
|
+
with pytest.raises(SalesforceException) as e:
|
|
1491
|
+
task()
|
|
1492
|
+
|
|
1493
|
+
assert "found" in str(e.value)
|
|
1494
|
+
|
|
1495
|
+
|
|
1496
|
+
class TestApexIntegrationTests:
|
|
1497
|
+
@pytest.mark.org_shape("qa", "ccitest:qa_org")
|
|
1498
|
+
@pytest.mark.slow()
|
|
1499
|
+
@pytest.mark.skip() # until our CI has access to github service, or test
|
|
1500
|
+
# doesn't rely on it. In the meantime, the VCR test below is still good
|
|
1501
|
+
# and this test works on laptops.
|
|
1502
|
+
def test_run_tests__integration_test__call_salesforce(self, create_task, caplog):
|
|
1503
|
+
self._test_run_tests__integration_test(create_task, caplog)
|
|
1504
|
+
|
|
1505
|
+
# There were challenges VCR-ing this because it depends on a
|
|
1506
|
+
# particular flow. To recreate the tape you'll need to run the
|
|
1507
|
+
# ccitest:qa_org flow aginst your org first.
|
|
1508
|
+
#
|
|
1509
|
+
# Also: some redundant "polls" were removed by hand to avoid
|
|
1510
|
+
# disk space usage.
|
|
1511
|
+
def test_run_tests__integration_test(self, create_task, caplog, vcr):
|
|
1512
|
+
with vcr.use_cassette(
|
|
1513
|
+
"ManualEditTestApexIntegrationTests.test_run_tests__integration_test.yaml",
|
|
1514
|
+
record_mode="none",
|
|
1515
|
+
):
|
|
1516
|
+
self._test_run_tests__integration_test(create_task, caplog)
|
|
1517
|
+
|
|
1518
|
+
def _test_run_tests__integration_test(self, create_task, caplog):
|
|
1519
|
+
caplog.set_level(logging.INFO)
|
|
1520
|
+
with pytest.raises(exc.ApexTestException) as e:
|
|
1521
|
+
task = create_task(
|
|
1522
|
+
RunApexTests,
|
|
1523
|
+
{
|
|
1524
|
+
"required_org_code_coverage_percent": 70,
|
|
1525
|
+
"required_per_class_code_coverage_percent": 60,
|
|
1526
|
+
"json_output": None,
|
|
1527
|
+
"junit_output": None,
|
|
1528
|
+
},
|
|
1529
|
+
)
|
|
1530
|
+
with patch.object(task, "_update_credentials"):
|
|
1531
|
+
task()
|
|
1532
|
+
relevant_records = [
|
|
1533
|
+
record for record in caplog.records if "below required level" in str(record)
|
|
1534
|
+
]
|
|
1535
|
+
assert len(relevant_records) == 1, caplog.records
|
|
1536
|
+
assert "SampleClass2" in str(relevant_records[0])
|
|
1537
|
+
assert "below required level" in str(e.value)
|
|
1538
|
+
assert "SampleClass2" in str(e.value)
|
|
1539
|
+
|
|
1540
|
+
caplog.clear()
|
|
1541
|
+
|
|
1542
|
+
task = create_task(
|
|
1543
|
+
RunApexTests,
|
|
1544
|
+
{
|
|
1545
|
+
"required_org_code_coverage_percent": 70,
|
|
1546
|
+
"required_per_class_code_coverage_percent": 40,
|
|
1547
|
+
"json_output": None,
|
|
1548
|
+
"junit_output": None,
|
|
1549
|
+
},
|
|
1550
|
+
)
|
|
1551
|
+
with patch.object(task, "_update_credentials"):
|
|
1552
|
+
task()
|
|
1553
|
+
relevant_records = [
|
|
1554
|
+
record for record in caplog.records if "expectations" in str(record)
|
|
1555
|
+
]
|
|
1556
|
+
assert len(relevant_records) == 2
|
|
1557
|
+
assert "All classes meet" in str(relevant_records)
|
|
1558
|
+
assert "Organization-wide code" in str(relevant_records)
|