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,942 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from ssl import SSLCertVerificationError
|
|
5
|
+
from unittest import mock
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
import requests
|
|
9
|
+
import responses
|
|
10
|
+
from github3 import GitHub, GitHubEnterprise
|
|
11
|
+
from github3.exceptions import (
|
|
12
|
+
AuthenticationFailed,
|
|
13
|
+
ConnectionError,
|
|
14
|
+
ForbiddenError,
|
|
15
|
+
ResponseError,
|
|
16
|
+
TransportError,
|
|
17
|
+
)
|
|
18
|
+
from github3.pulls import ShortPullRequest
|
|
19
|
+
from github3.repos.repo import Repository
|
|
20
|
+
from github3.session import AppInstallationTokenAuth
|
|
21
|
+
from requests.exceptions import RequestException, RetryError, SSLError
|
|
22
|
+
from requests.models import Response
|
|
23
|
+
|
|
24
|
+
import cumulusci
|
|
25
|
+
from cumulusci.core import github
|
|
26
|
+
from cumulusci.core.config import BaseProjectConfig, ServiceConfig, UniversalConfig
|
|
27
|
+
from cumulusci.core.exceptions import (
|
|
28
|
+
DependencyLookupError,
|
|
29
|
+
GithubApiError,
|
|
30
|
+
GithubApiNotFoundError,
|
|
31
|
+
GithubException,
|
|
32
|
+
ServiceNotConfigured,
|
|
33
|
+
)
|
|
34
|
+
from cumulusci.core.github import (
|
|
35
|
+
SELF_SIGNED_WARNING,
|
|
36
|
+
SSO_WARNING,
|
|
37
|
+
UNAUTHORIZED_WARNING,
|
|
38
|
+
_determine_github_client,
|
|
39
|
+
add_labels_to_pull_request,
|
|
40
|
+
catch_common_github_auth_errors,
|
|
41
|
+
check_github_sso_auth,
|
|
42
|
+
create_gist,
|
|
43
|
+
create_pull_request,
|
|
44
|
+
format_github3_exception,
|
|
45
|
+
get_auth_from_service,
|
|
46
|
+
get_commit,
|
|
47
|
+
get_github_api,
|
|
48
|
+
get_github_api_for_repo,
|
|
49
|
+
get_latest_prerelease,
|
|
50
|
+
get_oauth_device_flow_token,
|
|
51
|
+
get_oauth_scopes,
|
|
52
|
+
get_pull_requests_by_commit,
|
|
53
|
+
get_pull_requests_by_head,
|
|
54
|
+
get_pull_requests_with_base_branch,
|
|
55
|
+
get_ref_for_tag,
|
|
56
|
+
get_sso_disabled_orgs,
|
|
57
|
+
get_tag_by_name,
|
|
58
|
+
get_version_id_from_tag,
|
|
59
|
+
is_label_on_pull_request,
|
|
60
|
+
is_pull_request_merged,
|
|
61
|
+
markdown_link_to_pr,
|
|
62
|
+
request_url_from_exc,
|
|
63
|
+
validate_gh_enterprise,
|
|
64
|
+
validate_service,
|
|
65
|
+
warn_oauth_restricted,
|
|
66
|
+
)
|
|
67
|
+
from cumulusci.core.keychain import BaseProjectKeychain
|
|
68
|
+
from cumulusci.tasks.github.tests.util_github_api import GithubApiTestMixin
|
|
69
|
+
from cumulusci.tasks.release_notes.tests.utils import MockUtil
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class TestGithub(GithubApiTestMixin):
|
|
73
|
+
@classmethod
|
|
74
|
+
def teardown_method(cls):
|
|
75
|
+
# clear cached repo -> installation mapping
|
|
76
|
+
github.INSTALLATIONS.clear()
|
|
77
|
+
|
|
78
|
+
@pytest.fixture
|
|
79
|
+
def mock_util(self):
|
|
80
|
+
return MockUtil("TestOwner", "TestRepo")
|
|
81
|
+
|
|
82
|
+
@pytest.fixture
|
|
83
|
+
def repo(self, gh_api):
|
|
84
|
+
repo_json = self._get_expected_repo("TestOwner", "TestRepo")
|
|
85
|
+
return Repository(repo_json, gh_api)
|
|
86
|
+
|
|
87
|
+
@pytest.fixture
|
|
88
|
+
def keychain_enterprise(self):
|
|
89
|
+
runtime = mock.Mock()
|
|
90
|
+
runtime.project_config = BaseProjectConfig(UniversalConfig(), config={})
|
|
91
|
+
runtime.keychain = BaseProjectKeychain(runtime.project_config, None)
|
|
92
|
+
runtime.keychain.set_service(
|
|
93
|
+
"github_enterprise",
|
|
94
|
+
"ent",
|
|
95
|
+
ServiceConfig(
|
|
96
|
+
{
|
|
97
|
+
"username": "testusername",
|
|
98
|
+
"email": "test@domain.com",
|
|
99
|
+
"token": "ATOKEN",
|
|
100
|
+
"server_domain": "git.enterprise.domain.com",
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
)
|
|
104
|
+
return runtime.keychain
|
|
105
|
+
|
|
106
|
+
def test_github_api_retries__escape_hatch_SSL_error(self):
|
|
107
|
+
gh = get_github_api("TestUser", "TestPass")
|
|
108
|
+
adapter = gh.session.get_adapter("http://")
|
|
109
|
+
|
|
110
|
+
assert 0.3 == adapter.max_retries.backoff_factor
|
|
111
|
+
assert 502 in adapter.max_retries.status_forcelist
|
|
112
|
+
|
|
113
|
+
with mock.patch(
|
|
114
|
+
"urllib3.connectionpool.HTTPConnectionPool._make_request"
|
|
115
|
+
) as _make_request:
|
|
116
|
+
_make_request.side_effect = SSLCertVerificationError(
|
|
117
|
+
"SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain"
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
with pytest.raises(
|
|
121
|
+
ConnectionError,
|
|
122
|
+
match="(CERTIFICATE_VERIFY_FAILED)",
|
|
123
|
+
):
|
|
124
|
+
gh.octocat("meow")
|
|
125
|
+
|
|
126
|
+
assert 1 == _make_request.call_count
|
|
127
|
+
|
|
128
|
+
def test_github_api_retries(self):
|
|
129
|
+
gh = get_github_api("TestUser", "TestPass")
|
|
130
|
+
adapter = gh.session.get_adapter("http://")
|
|
131
|
+
|
|
132
|
+
assert 0.3 == adapter.max_retries.backoff_factor
|
|
133
|
+
assert 502 in adapter.max_retries.status_forcelist
|
|
134
|
+
|
|
135
|
+
user_json = {
|
|
136
|
+
"login": "TestUser",
|
|
137
|
+
"id": 123456,
|
|
138
|
+
"type": "User",
|
|
139
|
+
"url": "https://api.github.com/user",
|
|
140
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/123456?v=4",
|
|
141
|
+
"events_url": "https://api.github.com/users/TestUser/events{/privacy}",
|
|
142
|
+
"followers_url": "https://api.github.com/users/TestUser/followers",
|
|
143
|
+
"following_url": "https://api.github.com/users/TestUser/following{/other_user}",
|
|
144
|
+
"gists_url": "https://api.github.com/users/TestUser/gists{/gist_id}",
|
|
145
|
+
"gravatar_id": "",
|
|
146
|
+
"html_url": "https://github.com/TestUser",
|
|
147
|
+
"organizations_url": "https://api.github.com/users/TestUser/orgs",
|
|
148
|
+
"received_events_url": "https://api.github.com/users/TestUser/received_events",
|
|
149
|
+
"repos_url": "https://api.github.com/users/TestUser/repos",
|
|
150
|
+
"site_admin": False,
|
|
151
|
+
"starred_url": "https://api.github.com/users/TestUser/starred{/owner}{/repo}",
|
|
152
|
+
"subscriptions_url": "https://api.github.com/users/TestUser/subscriptions",
|
|
153
|
+
"bio": "Test bio",
|
|
154
|
+
"blog": "https://testuserblog.com",
|
|
155
|
+
"company": "Test Company",
|
|
156
|
+
"created_at": "2020-01-01T00:00:00Z",
|
|
157
|
+
"email": "testuser@example.com",
|
|
158
|
+
"followers": 10,
|
|
159
|
+
"following": 5,
|
|
160
|
+
"hireable": True,
|
|
161
|
+
"location": "Test City",
|
|
162
|
+
"name": "Test User",
|
|
163
|
+
"public_gists": 2,
|
|
164
|
+
"public_repos": 3,
|
|
165
|
+
"updated_at": "2023-01-01T00:00:00Z",
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
with responses.RequestsMock() as rsps:
|
|
169
|
+
rsps.add(responses.GET, "https://api.github.com/user", status=503)
|
|
170
|
+
rsps.add(
|
|
171
|
+
responses.GET, "https://api.github.com/user", json=user_json, status=200
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
gh.me()
|
|
175
|
+
assert len(rsps.calls) == 2
|
|
176
|
+
|
|
177
|
+
@responses.activate
|
|
178
|
+
@mock.patch("github3.apps.create_token")
|
|
179
|
+
def test_get_github_api_for_repo(self, create_token):
|
|
180
|
+
create_token.return_value = "ATOKEN"
|
|
181
|
+
responses.add(
|
|
182
|
+
"GET",
|
|
183
|
+
"https://api.github.com/repos/TestOwner/TestRepo/installation",
|
|
184
|
+
json={
|
|
185
|
+
"id": 1,
|
|
186
|
+
"access_tokens_url": "",
|
|
187
|
+
"account": "",
|
|
188
|
+
"app_id": "",
|
|
189
|
+
"created_at": "",
|
|
190
|
+
"events": "",
|
|
191
|
+
"html_url": "",
|
|
192
|
+
"permissions": "",
|
|
193
|
+
"repositories_url": "",
|
|
194
|
+
"repository_selection": "",
|
|
195
|
+
"single_file_name": "",
|
|
196
|
+
"target_id": "",
|
|
197
|
+
"target_type": "",
|
|
198
|
+
"updated_at": "",
|
|
199
|
+
},
|
|
200
|
+
)
|
|
201
|
+
responses.add(
|
|
202
|
+
"POST",
|
|
203
|
+
"https://api.github.com/app/installations/1/access_tokens",
|
|
204
|
+
status=201,
|
|
205
|
+
json={"token": "ITOKEN", "expires_at": datetime.now().isoformat()},
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
with mock.patch.dict(
|
|
209
|
+
os.environ, {"GITHUB_APP_KEY": "bogus", "GITHUB_APP_ID": "1234"}
|
|
210
|
+
):
|
|
211
|
+
gh = get_github_api_for_repo(None, "https://github.com/TestOwner/TestRepo/")
|
|
212
|
+
assert isinstance(gh.session.auth, AppInstallationTokenAuth)
|
|
213
|
+
|
|
214
|
+
@responses.activate
|
|
215
|
+
@mock.patch("github3.apps.create_token")
|
|
216
|
+
def test_get_github_api_for_repo__not_installed(self, create_token):
|
|
217
|
+
create_token.return_value = "ATOKEN"
|
|
218
|
+
responses.add(
|
|
219
|
+
"GET",
|
|
220
|
+
"https://api.github.com/repos/TestOwner/TestRepo/installation",
|
|
221
|
+
status=404,
|
|
222
|
+
)
|
|
223
|
+
with mock.patch.dict(
|
|
224
|
+
os.environ, {"GITHUB_APP_KEY": "bogus", "GITHUB_APP_ID": "1234"}
|
|
225
|
+
):
|
|
226
|
+
with pytest.raises(GithubException):
|
|
227
|
+
get_github_api_for_repo(None, "https://github.com/TestOwner/TestRepo/")
|
|
228
|
+
|
|
229
|
+
@responses.activate
|
|
230
|
+
@mock.patch("cumulusci.core.github.GitHub")
|
|
231
|
+
def test_get_github_api_for_repo__token(self, GitHub):
|
|
232
|
+
with mock.patch.dict(os.environ, {"GITHUB_TOKEN": "token"}):
|
|
233
|
+
gh = get_github_api_for_repo(None, "https://github.com/TestOwner/TestRepo/")
|
|
234
|
+
gh.login.assert_called_once_with(token="token")
|
|
235
|
+
|
|
236
|
+
@responses.activate
|
|
237
|
+
@mock.patch("cumulusci.core.github.GitHubEnterprise")
|
|
238
|
+
def test_get_github_api_for_repo__enterprise(
|
|
239
|
+
self, GitHubEnterprise, keychain_enterprise
|
|
240
|
+
):
|
|
241
|
+
|
|
242
|
+
gh = get_github_api_for_repo(
|
|
243
|
+
keychain_enterprise, "https://git.enterprise.domain.com/TestOwner/TestRepo/"
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
gh.login.assert_called_once_with(token="ATOKEN")
|
|
247
|
+
|
|
248
|
+
@responses.activate
|
|
249
|
+
def test_validate_service(self, keychain_enterprise):
|
|
250
|
+
responses.add("GET", "https://api.github.com/user", status=401, headers={})
|
|
251
|
+
|
|
252
|
+
with pytest.raises(GithubException):
|
|
253
|
+
validate_service(
|
|
254
|
+
{"username": "BOGUS", "token": "BOGUS"}, keychain_enterprise
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
@responses.activate
|
|
258
|
+
def test_validate_gh_enterprise(self, keychain_enterprise):
|
|
259
|
+
keychain_enterprise.set_service(
|
|
260
|
+
"github_enterprise",
|
|
261
|
+
"ent2",
|
|
262
|
+
ServiceConfig(
|
|
263
|
+
{
|
|
264
|
+
"username": "testusername2",
|
|
265
|
+
"email": "test2@domain.com",
|
|
266
|
+
"token": "ATOKEN2",
|
|
267
|
+
"server_domain": "git.enterprise.domain.com",
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
with pytest.raises(
|
|
273
|
+
GithubException,
|
|
274
|
+
match="More than one Github Enterprise service configured for domain git.enterprise.domain.com",
|
|
275
|
+
):
|
|
276
|
+
validate_gh_enterprise("git.enterprise.domain.com", keychain_enterprise)
|
|
277
|
+
|
|
278
|
+
@responses.activate
|
|
279
|
+
def test_get_auth_from_service(self, keychain_enterprise):
|
|
280
|
+
# github service, should be ignored
|
|
281
|
+
keychain_enterprise.set_service(
|
|
282
|
+
"github",
|
|
283
|
+
"ent",
|
|
284
|
+
ServiceConfig(
|
|
285
|
+
{
|
|
286
|
+
"username": "testusername",
|
|
287
|
+
"email": "test@domain.com",
|
|
288
|
+
"token": "ATOKEN",
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
)
|
|
292
|
+
assert (
|
|
293
|
+
get_auth_from_service("git.enterprise.domain.com", keychain_enterprise)
|
|
294
|
+
== "ATOKEN"
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
with pytest.raises(
|
|
298
|
+
ServiceNotConfigured,
|
|
299
|
+
match="No Github Enterprise service configured for domain garbage",
|
|
300
|
+
):
|
|
301
|
+
get_auth_from_service("garbage", keychain_enterprise)
|
|
302
|
+
|
|
303
|
+
@pytest.mark.parametrize(
|
|
304
|
+
"domain,client",
|
|
305
|
+
[
|
|
306
|
+
(None, GitHub),
|
|
307
|
+
("github.com", GitHub),
|
|
308
|
+
("api.github.com", GitHub),
|
|
309
|
+
("git.enterprise.domain.com", GitHubEnterprise),
|
|
310
|
+
],
|
|
311
|
+
)
|
|
312
|
+
def test_determine_github_client(self, domain, client):
|
|
313
|
+
client_result = _determine_github_client(domain, {})
|
|
314
|
+
assert type(client_result) is client
|
|
315
|
+
|
|
316
|
+
@responses.activate
|
|
317
|
+
def test_get_pull_requests_by_head(self, mock_util, repo):
|
|
318
|
+
self.init_github()
|
|
319
|
+
mock_util.mock_pulls(
|
|
320
|
+
pulls=self._get_expected_pull_requests(1),
|
|
321
|
+
head=repo.owner.login + ":" + "some-other-branch",
|
|
322
|
+
)
|
|
323
|
+
pull_requests = get_pull_requests_by_head(repo, "some-other-branch")
|
|
324
|
+
assert 1 == len(pull_requests)
|
|
325
|
+
|
|
326
|
+
# ConnectionError present when we reachout with
|
|
327
|
+
# a branch name (url parameter) that we aren't expecting
|
|
328
|
+
with pytest.raises(ConnectionError):
|
|
329
|
+
get_pull_requests_by_head(repo, "does-not-exist")
|
|
330
|
+
|
|
331
|
+
@responses.activate
|
|
332
|
+
def test_get_pull_requests_by_head__no_pulls(self, mock_util, repo):
|
|
333
|
+
self.init_github()
|
|
334
|
+
mock_util.mock_pulls()
|
|
335
|
+
pull_requests = get_pull_requests_by_head(repo, "test_branch")
|
|
336
|
+
assert pull_requests == []
|
|
337
|
+
|
|
338
|
+
pull_requests = get_pull_requests_by_head(repo, "main")
|
|
339
|
+
assert pull_requests is None
|
|
340
|
+
|
|
341
|
+
@responses.activate
|
|
342
|
+
def test_get_pull_request_by_head__multiple_pulls(self, mock_util, repo):
|
|
343
|
+
self.init_github()
|
|
344
|
+
mock_util.mock_pulls(pulls=self._get_expected_pull_requests(2))
|
|
345
|
+
pull_requests = get_pull_requests_by_head(repo, "test_branch")
|
|
346
|
+
assert 2 == len(pull_requests)
|
|
347
|
+
|
|
348
|
+
@responses.activate
|
|
349
|
+
def test_get_pull_requests_with_base_branch(self, mock_util, repo):
|
|
350
|
+
self.init_github()
|
|
351
|
+
mock_util.mock_pulls(base="main", head="TestOwner:some-branch")
|
|
352
|
+
pull_requests = get_pull_requests_with_base_branch(
|
|
353
|
+
repo, "main", head="some-branch"
|
|
354
|
+
)
|
|
355
|
+
assert 0 == len(pull_requests)
|
|
356
|
+
|
|
357
|
+
responses.reset()
|
|
358
|
+
mock_util.mock_pulls(pulls=self._get_expected_pull_requests(3), base="main")
|
|
359
|
+
pull_requests = get_pull_requests_with_base_branch(repo, "main")
|
|
360
|
+
assert 3 == len(pull_requests)
|
|
361
|
+
|
|
362
|
+
@responses.activate
|
|
363
|
+
def test_create_pull_request(self, mock_util, repo, gh_api):
|
|
364
|
+
self.init_github()
|
|
365
|
+
mock_util.mock_pulls(
|
|
366
|
+
method=responses.POST,
|
|
367
|
+
pulls=self._get_expected_pull_request(1, 1, "Test Body"),
|
|
368
|
+
)
|
|
369
|
+
pull_request = create_pull_request(repo, "test-branch")
|
|
370
|
+
assert pull_request is not None
|
|
371
|
+
assert pull_request.body == "Test Body"
|
|
372
|
+
|
|
373
|
+
@responses.activate
|
|
374
|
+
def test_is_label_on_pr(self, mock_util, repo, gh_api):
|
|
375
|
+
self.init_github()
|
|
376
|
+
mock_util.add_issue_response(self._get_expected_issue(1))
|
|
377
|
+
mock_util.add_issue_response(self._get_expected_issue(2))
|
|
378
|
+
mock_util.mock_issue_labels(1, responses.GET, ["Octocat", "bogus 1", "bogus 2"])
|
|
379
|
+
mock_util.mock_issue_labels(2, responses.GET, ["bogus 1", "bogus 2"])
|
|
380
|
+
|
|
381
|
+
pull_request = ShortPullRequest(self._get_expected_pull_request(1, 1), gh_api)
|
|
382
|
+
pull_request.number = 1
|
|
383
|
+
assert is_label_on_pull_request(repo, pull_request, "Octocat")
|
|
384
|
+
pull_request.number = 2
|
|
385
|
+
assert not is_label_on_pull_request(repo, pull_request, "Octocat")
|
|
386
|
+
|
|
387
|
+
@responses.activate
|
|
388
|
+
def test_add_labels_to_pull_request(self, mock_util, repo, gh_api):
|
|
389
|
+
self.init_github()
|
|
390
|
+
mock_util.add_issue_response(self._get_expected_issue(1))
|
|
391
|
+
mock_util.mock_issue_labels(1, method=responses.POST)
|
|
392
|
+
pull_request = ShortPullRequest(self._get_expected_pull_request(1, 1), gh_api)
|
|
393
|
+
pull_request.number = 1
|
|
394
|
+
|
|
395
|
+
add_labels_to_pull_request(repo, pull_request, "first", "second", "third")
|
|
396
|
+
body = responses.calls[-1].request.body
|
|
397
|
+
assert "first" in body
|
|
398
|
+
assert "second" in body
|
|
399
|
+
assert "third" in body
|
|
400
|
+
|
|
401
|
+
@responses.activate
|
|
402
|
+
def test_get_pull_request_by_commit(self, mock_util, repo, gh_api):
|
|
403
|
+
self.init_github()
|
|
404
|
+
commit_sha = "asdf1234asdf1234"
|
|
405
|
+
mock_util.mock_pull_request_by_commit_sha(commit_sha)
|
|
406
|
+
pull_requests = get_pull_requests_by_commit(gh_api, repo, commit_sha)
|
|
407
|
+
assert len(pull_requests) == 1
|
|
408
|
+
|
|
409
|
+
def test_is_pull_request_merged(self, gh_api):
|
|
410
|
+
self.init_github()
|
|
411
|
+
|
|
412
|
+
merged_pull_request = ShortPullRequest(
|
|
413
|
+
self._get_expected_pull_request(1, 1), gh_api
|
|
414
|
+
)
|
|
415
|
+
merged_pull_request.merged_at = "DateTimeStr"
|
|
416
|
+
|
|
417
|
+
unmerged_pull_request = ShortPullRequest(
|
|
418
|
+
self._get_expected_pull_request(1, 1), gh_api
|
|
419
|
+
)
|
|
420
|
+
unmerged_pull_request.merged_at = None
|
|
421
|
+
|
|
422
|
+
assert is_pull_request_merged(merged_pull_request)
|
|
423
|
+
assert not is_pull_request_merged(unmerged_pull_request)
|
|
424
|
+
|
|
425
|
+
def test_markdown_link_to_pr(self, gh_api):
|
|
426
|
+
self.init_github()
|
|
427
|
+
pr = ShortPullRequest(self._get_expected_pull_request(1, 1), gh_api)
|
|
428
|
+
actual_link = markdown_link_to_pr(pr)
|
|
429
|
+
expected_link = f"{pr.title} [[PR{pr.number}]({pr.html_url})]"
|
|
430
|
+
|
|
431
|
+
assert expected_link == actual_link
|
|
432
|
+
|
|
433
|
+
@responses.activate
|
|
434
|
+
def test_create_gist(self, gh_api, mock_util):
|
|
435
|
+
self.init_github()
|
|
436
|
+
|
|
437
|
+
description = "Test Gist Creation"
|
|
438
|
+
filename = "error_output.txt"
|
|
439
|
+
content = "Hello there gist!"
|
|
440
|
+
files = {filename: content}
|
|
441
|
+
|
|
442
|
+
self.mock_gist(description, files)
|
|
443
|
+
gist = create_gist(gh_api, description, files)
|
|
444
|
+
|
|
445
|
+
expected_url = f"https://gist.github.com/{gist.id}"
|
|
446
|
+
assert expected_url == gist.html_url
|
|
447
|
+
|
|
448
|
+
def mock_gist(self, description, files):
|
|
449
|
+
responses.add(
|
|
450
|
+
method=responses.POST,
|
|
451
|
+
url="https://api.github.com/gists",
|
|
452
|
+
json=self._get_expected_gist(description, files),
|
|
453
|
+
status=201,
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
@responses.activate
|
|
457
|
+
def test_create_gist_no_scope(self, gh_api):
|
|
458
|
+
responses.add(
|
|
459
|
+
method=responses.POST,
|
|
460
|
+
url="https://api.github.com/gists",
|
|
461
|
+
status=403,
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
self.init_github()
|
|
465
|
+
|
|
466
|
+
description = "Test Gist Creation"
|
|
467
|
+
filename = "error_output.txt"
|
|
468
|
+
content = "Hello there gist!"
|
|
469
|
+
files = {filename: content}
|
|
470
|
+
|
|
471
|
+
with pytest.raises(GithubApiError, match="scopes: gist"):
|
|
472
|
+
create_gist(gh_api, description, files)
|
|
473
|
+
|
|
474
|
+
@responses.activate
|
|
475
|
+
def test_get_tag_by_name(self, repo):
|
|
476
|
+
self.init_github()
|
|
477
|
+
responses.add(
|
|
478
|
+
"GET",
|
|
479
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/ref/tags/tag_SHA",
|
|
480
|
+
json=self._get_expected_tag_ref("tag_SHA", "tag_SHA"),
|
|
481
|
+
status=200,
|
|
482
|
+
)
|
|
483
|
+
responses.add(
|
|
484
|
+
"GET",
|
|
485
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/tags/tag_SHA",
|
|
486
|
+
json=self._get_expected_tag("beta/1.0", "tag_SHA"),
|
|
487
|
+
status=200,
|
|
488
|
+
)
|
|
489
|
+
tag = get_tag_by_name(repo, "tag_SHA")
|
|
490
|
+
assert tag.tag == "beta/1.0"
|
|
491
|
+
|
|
492
|
+
@responses.activate
|
|
493
|
+
def test_get_tag_by_name__404(self, repo):
|
|
494
|
+
self.init_github()
|
|
495
|
+
responses.add(
|
|
496
|
+
"GET",
|
|
497
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/ref/tags/tag_SHA",
|
|
498
|
+
json=self._get_expected_tag_ref("tag_SHA", "tag_SHA"),
|
|
499
|
+
status=200,
|
|
500
|
+
)
|
|
501
|
+
responses.add(
|
|
502
|
+
"GET",
|
|
503
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/tags/tag_SHA",
|
|
504
|
+
json=self._get_expected_tag("beta/1.0", "tag_SHA"),
|
|
505
|
+
status=404,
|
|
506
|
+
)
|
|
507
|
+
with pytest.raises(GithubApiNotFoundError):
|
|
508
|
+
get_tag_by_name(repo, "tag_SHA")
|
|
509
|
+
|
|
510
|
+
@responses.activate
|
|
511
|
+
def test_current_tag_is_lightweight(self, repo):
|
|
512
|
+
self.init_github()
|
|
513
|
+
light_tag = self._get_expected_tag_ref("tag_SHA", "tag_SHA")
|
|
514
|
+
light_tag["object"]["type"] = "commit"
|
|
515
|
+
responses.add(
|
|
516
|
+
"GET",
|
|
517
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/ref/tags/tag_SHA",
|
|
518
|
+
json=light_tag,
|
|
519
|
+
status=200,
|
|
520
|
+
)
|
|
521
|
+
responses.add(
|
|
522
|
+
"GET",
|
|
523
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/tags/tag_SHA",
|
|
524
|
+
json=self._get_expected_tag("beta/1.0", "tag_SHA"),
|
|
525
|
+
status=404,
|
|
526
|
+
)
|
|
527
|
+
with pytest.raises(GithubApiNotFoundError) as exc:
|
|
528
|
+
get_tag_by_name(repo, "tag_SHA")
|
|
529
|
+
|
|
530
|
+
assert "not an annotated tag" in str(exc)
|
|
531
|
+
|
|
532
|
+
@responses.activate
|
|
533
|
+
def test_get_ref_by_name(self, repo):
|
|
534
|
+
self.init_github()
|
|
535
|
+
responses.add(
|
|
536
|
+
"GET",
|
|
537
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/ref/tags/tag_SHA",
|
|
538
|
+
json=self._get_expected_tag_ref("tag_SHA", "tag_SHA"),
|
|
539
|
+
status=200,
|
|
540
|
+
)
|
|
541
|
+
ref = get_ref_for_tag(repo, "tag_SHA")
|
|
542
|
+
assert ref.object.sha == "tag_SHA"
|
|
543
|
+
|
|
544
|
+
@responses.activate
|
|
545
|
+
def test_get_ref_by_name__404(self, repo):
|
|
546
|
+
self.init_github()
|
|
547
|
+
responses.add(
|
|
548
|
+
"GET",
|
|
549
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/ref/tags/tag_SHA",
|
|
550
|
+
json=self._get_expected_tag_ref("tag_SHA", "tag_SHA"),
|
|
551
|
+
status=404,
|
|
552
|
+
)
|
|
553
|
+
with pytest.raises(GithubApiNotFoundError):
|
|
554
|
+
get_ref_for_tag(repo, "tag_SHA")
|
|
555
|
+
|
|
556
|
+
@responses.activate
|
|
557
|
+
def test_get_version_id_from_tag(self, repo):
|
|
558
|
+
self.init_github()
|
|
559
|
+
responses.add( # the ref for the tag is fetched first
|
|
560
|
+
"GET",
|
|
561
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/ref/tags/test-tag-name",
|
|
562
|
+
json=self._get_expected_tag_ref("test-tag-name", "tag_SHA"),
|
|
563
|
+
status=200,
|
|
564
|
+
)
|
|
565
|
+
tag_message = """Release of Test Package\nversion_id: 04t000000000000\n\ndependencies: []"""
|
|
566
|
+
responses.add( # then we fetch that actual tag with the ref
|
|
567
|
+
"GET",
|
|
568
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/tags/tag_SHA",
|
|
569
|
+
json=self._get_expected_tag("beta/1.0", "tag_SHA", message=tag_message),
|
|
570
|
+
status=200,
|
|
571
|
+
)
|
|
572
|
+
version_id = get_version_id_from_tag(repo, "test-tag-name")
|
|
573
|
+
assert version_id == "04t000000000000"
|
|
574
|
+
|
|
575
|
+
@responses.activate
|
|
576
|
+
def test_get_version_id_from_tag__dependency_error(self, repo):
|
|
577
|
+
self.init_github()
|
|
578
|
+
responses.add( # the ref for the tag is fetched first
|
|
579
|
+
"GET",
|
|
580
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/ref/tags/test-tag-name",
|
|
581
|
+
json=self._get_expected_tag_ref("test-tag-name", "tag_SHA"),
|
|
582
|
+
status=200,
|
|
583
|
+
)
|
|
584
|
+
tag_message = (
|
|
585
|
+
"""Release of Test Package\nversion_id: invalid_id\n\ndependencies: []"""
|
|
586
|
+
)
|
|
587
|
+
responses.add( # then we fetch that actual tag with the ref
|
|
588
|
+
"GET",
|
|
589
|
+
"https://api.github.com/repos/TestOwner/TestRepo/git/tags/tag_SHA",
|
|
590
|
+
json=self._get_expected_tag("beta/1.0", "tag_SHA", message=tag_message),
|
|
591
|
+
status=200,
|
|
592
|
+
)
|
|
593
|
+
with pytest.raises(DependencyLookupError):
|
|
594
|
+
get_version_id_from_tag(repo, "test-tag-name")
|
|
595
|
+
|
|
596
|
+
@responses.activate
|
|
597
|
+
def test_get_commit(self, repo):
|
|
598
|
+
self.init_github()
|
|
599
|
+
responses.add(
|
|
600
|
+
method=responses.GET,
|
|
601
|
+
url=self.repo_api_url + "/commits/DUMMY_SHA",
|
|
602
|
+
json=self._get_expected_commit("DUMMY_SHA"),
|
|
603
|
+
status=200,
|
|
604
|
+
)
|
|
605
|
+
commit = get_commit(repo, "DUMMY_SHA")
|
|
606
|
+
assert commit.sha == "DUMMY_SHA"
|
|
607
|
+
|
|
608
|
+
@responses.activate
|
|
609
|
+
def test_get_commit__dependency_error(self, repo):
|
|
610
|
+
self.init_github()
|
|
611
|
+
responses.add(
|
|
612
|
+
method=responses.GET,
|
|
613
|
+
url=self.repo_api_url + "/commits/DUMMY_SHA",
|
|
614
|
+
json={"message": "Could not verify object"},
|
|
615
|
+
status=422,
|
|
616
|
+
)
|
|
617
|
+
with pytest.raises(
|
|
618
|
+
DependencyLookupError, match="Could not find commit DUMMY_SHA on GitHub"
|
|
619
|
+
):
|
|
620
|
+
get_commit(repo, "DUMMY_SHA")
|
|
621
|
+
|
|
622
|
+
def test_get_oauth_scopes(self):
|
|
623
|
+
resp = Response()
|
|
624
|
+
resp.headers["X-OAuth-Scopes"] = "repo, user"
|
|
625
|
+
assert {"repo", "user"} == get_oauth_scopes(resp)
|
|
626
|
+
|
|
627
|
+
resp = Response()
|
|
628
|
+
resp.headers["X-OAuth-Scopes"] = "repo"
|
|
629
|
+
assert {"repo"} == get_oauth_scopes(resp)
|
|
630
|
+
|
|
631
|
+
resp = Response()
|
|
632
|
+
assert set() == get_oauth_scopes(resp)
|
|
633
|
+
|
|
634
|
+
def test_get_sso_disabled_orgs(self):
|
|
635
|
+
resp = Response()
|
|
636
|
+
assert [] == get_sso_disabled_orgs(resp)
|
|
637
|
+
|
|
638
|
+
resp = Response()
|
|
639
|
+
resp.headers["X-Github-Sso"] = "partial-results; organizations=0810298,20348880"
|
|
640
|
+
assert ["0810298", "20348880"] == get_sso_disabled_orgs(resp)
|
|
641
|
+
|
|
642
|
+
def test_check_github_sso_no_forbidden(self):
|
|
643
|
+
resp = Response()
|
|
644
|
+
resp.status_code = 401
|
|
645
|
+
exc = AuthenticationFailed(resp)
|
|
646
|
+
assert check_github_sso_auth(exc) == ""
|
|
647
|
+
|
|
648
|
+
resp.status_code = 403
|
|
649
|
+
exc = ForbiddenError(resp)
|
|
650
|
+
assert check_github_sso_auth(exc) == ""
|
|
651
|
+
|
|
652
|
+
@mock.patch("webbrowser.open")
|
|
653
|
+
def test_check_github_sso_unauthorized_token(self, browser_open):
|
|
654
|
+
resp = Response()
|
|
655
|
+
resp.status_code = 403
|
|
656
|
+
auth_url = "https://github.com/orgs/foo/sso?authorization_request=longhash"
|
|
657
|
+
resp.headers["X-Github-Sso"] = f"required; url={auth_url}"
|
|
658
|
+
exc = ForbiddenError(resp)
|
|
659
|
+
|
|
660
|
+
check_github_sso_auth(exc)
|
|
661
|
+
|
|
662
|
+
browser_open.assert_called_with(auth_url)
|
|
663
|
+
|
|
664
|
+
def test_check_github_sso_partial_auth(self):
|
|
665
|
+
resp = Response()
|
|
666
|
+
resp.status_code = 403
|
|
667
|
+
resp.headers["X-Github-Sso"] = "partial-results; organizations=0810298,20348880"
|
|
668
|
+
exc = ForbiddenError(resp)
|
|
669
|
+
|
|
670
|
+
expected_err_msg = f"{SSO_WARNING} ['0810298', '20348880']"
|
|
671
|
+
actual_error_msg = check_github_sso_auth(exc).strip()
|
|
672
|
+
assert expected_err_msg == actual_error_msg
|
|
673
|
+
|
|
674
|
+
def test_github_oauth_org_restricted(self):
|
|
675
|
+
resp = Response()
|
|
676
|
+
resp.status_code = 403
|
|
677
|
+
body = {"message": "organization has enabled OAuth App access restriction"}
|
|
678
|
+
resp._content = json.dumps(body)
|
|
679
|
+
exc = ForbiddenError(resp)
|
|
680
|
+
|
|
681
|
+
expected_warning = "You may also use a Personal Access Token as a workaround."
|
|
682
|
+
actual_error_msg = warn_oauth_restricted(exc)
|
|
683
|
+
assert expected_warning in actual_error_msg
|
|
684
|
+
|
|
685
|
+
def test_format_gh3_exc_retry(self):
|
|
686
|
+
resp = Response()
|
|
687
|
+
resp.status_code = 401
|
|
688
|
+
message = "Max retries exceeded with url: foo (Caused by ResponseError('too many 401 error responses',))"
|
|
689
|
+
base_exc = RetryError(message, response=resp)
|
|
690
|
+
exc = TransportError(base_exc)
|
|
691
|
+
assert UNAUTHORIZED_WARNING == format_github3_exception(exc)
|
|
692
|
+
|
|
693
|
+
def test_format_gh3_self_signed_ssl(self):
|
|
694
|
+
resp = Response()
|
|
695
|
+
resp.status_code = 401
|
|
696
|
+
message = "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain"
|
|
697
|
+
base_exc = SSLError(message, response=resp)
|
|
698
|
+
exc = ConnectionError(base_exc)
|
|
699
|
+
assert SELF_SIGNED_WARNING == format_github3_exception(exc)
|
|
700
|
+
|
|
701
|
+
# Test passsthrough of other conenction errors
|
|
702
|
+
base_exc = SSLError(response=resp)
|
|
703
|
+
exc = ConnectionError(base_exc)
|
|
704
|
+
assert format_github3_exception(exc) == ""
|
|
705
|
+
|
|
706
|
+
def test_format_url_from_exc(self):
|
|
707
|
+
resp = Response()
|
|
708
|
+
resp.status_code = 401
|
|
709
|
+
resp.url = expected_url = "http://example.com"
|
|
710
|
+
message = "Max retries exceeded with url: foo (Caused by ResponseError('too many 401 error responses',))"
|
|
711
|
+
base_exc = RetryError(message, response=resp)
|
|
712
|
+
exc = TransportError(base_exc)
|
|
713
|
+
resp_exc = ResponseError(resp)
|
|
714
|
+
assert expected_url == request_url_from_exc(exc)
|
|
715
|
+
assert expected_url == request_url_from_exc(resp_exc)
|
|
716
|
+
|
|
717
|
+
def test_catch_common_decorator(self):
|
|
718
|
+
resp = Response()
|
|
719
|
+
resp.status_code = 403
|
|
720
|
+
resp.headers["X-Github-Sso"] = "partial-results; organizations=0810298,20348880"
|
|
721
|
+
resp.url = "http://zombo.com"
|
|
722
|
+
|
|
723
|
+
expected_err_msg = "http://zombo.com\nResults may be incomplete. You have not granted your Personal Access token access to the following organizations: ['0810298', '20348880']"
|
|
724
|
+
|
|
725
|
+
@catch_common_github_auth_errors
|
|
726
|
+
def test_func():
|
|
727
|
+
raise ForbiddenError(resp)
|
|
728
|
+
|
|
729
|
+
with pytest.raises(GithubApiError) as exc:
|
|
730
|
+
test_func()
|
|
731
|
+
actual_error_msg = exc.message
|
|
732
|
+
assert expected_err_msg == actual_error_msg
|
|
733
|
+
|
|
734
|
+
@responses.activate
|
|
735
|
+
def test_catch_common_decorator_transport_url(self):
|
|
736
|
+
mock_rsp = responses.Response(
|
|
737
|
+
method=responses.GET,
|
|
738
|
+
url="https://api.github.com/rate_limit",
|
|
739
|
+
status=401,
|
|
740
|
+
headers={"X-Github-Sso": "partial-results; organizations=0810298,20348880"},
|
|
741
|
+
)
|
|
742
|
+
responses.add(mock_rsp)
|
|
743
|
+
|
|
744
|
+
rsp = requests.get("https://api.github.com/rate_limit")
|
|
745
|
+
responses.calls.reset()
|
|
746
|
+
|
|
747
|
+
retry_err = RetryError("too many 401 error responses")
|
|
748
|
+
retry_err.response = rsp
|
|
749
|
+
mock_rsp.body = retry_err
|
|
750
|
+
|
|
751
|
+
@catch_common_github_auth_errors
|
|
752
|
+
def test_func():
|
|
753
|
+
GitHub().rate_limit()
|
|
754
|
+
|
|
755
|
+
with pytest.raises(
|
|
756
|
+
GithubApiError, match="^https://api.github.com/rate_limit\n"
|
|
757
|
+
):
|
|
758
|
+
test_func()
|
|
759
|
+
|
|
760
|
+
def test_catch_common_decorator_ignores(self):
|
|
761
|
+
resp = Response()
|
|
762
|
+
resp.status_code = 401
|
|
763
|
+
|
|
764
|
+
@catch_common_github_auth_errors
|
|
765
|
+
def test_func():
|
|
766
|
+
e = RequestException(response=resp)
|
|
767
|
+
raise TransportError(e)
|
|
768
|
+
|
|
769
|
+
with pytest.raises(TransportError):
|
|
770
|
+
test_func()
|
|
771
|
+
|
|
772
|
+
@responses.activate
|
|
773
|
+
def test_catch_common_decorator_connection_error(self):
|
|
774
|
+
|
|
775
|
+
mock_rsp = responses.Response(
|
|
776
|
+
method=responses.GET,
|
|
777
|
+
url="https://api.github.com/rate_limit",
|
|
778
|
+
body=ConnectionError("self signed certificate"),
|
|
779
|
+
)
|
|
780
|
+
responses.add(mock_rsp)
|
|
781
|
+
|
|
782
|
+
@catch_common_github_auth_errors
|
|
783
|
+
def test_func():
|
|
784
|
+
GitHub().rate_limit()
|
|
785
|
+
|
|
786
|
+
with pytest.raises(
|
|
787
|
+
GithubApiError,
|
|
788
|
+
match="(self-signed certificate in the certificate chain)",
|
|
789
|
+
):
|
|
790
|
+
test_func()
|
|
791
|
+
|
|
792
|
+
@responses.activate
|
|
793
|
+
def test_validate_no_repo_exc(self, keychain_enterprise):
|
|
794
|
+
service_dict = {
|
|
795
|
+
"username": "e2ac67",
|
|
796
|
+
"token": "ghp_cf83e1357eefb8bdf1542850d66d8007d620e4",
|
|
797
|
+
"email": "testerson@test.com",
|
|
798
|
+
}
|
|
799
|
+
responses.add(
|
|
800
|
+
responses.GET,
|
|
801
|
+
"https://api.github.com/user",
|
|
802
|
+
json={
|
|
803
|
+
"login": "e2ac67",
|
|
804
|
+
"id": 91303375,
|
|
805
|
+
"node_id": "MDQ6VXNlcjkxMzAzMzc1",
|
|
806
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/91303375?v=4",
|
|
807
|
+
"gravatar_id": "",
|
|
808
|
+
"url": "https://api.github.com/users/e2ac67",
|
|
809
|
+
"html_url": "https://github.com/e2ac67",
|
|
810
|
+
"followers_url": "https://api.github.com/users/e2ac67/followers",
|
|
811
|
+
"following_url": "https://api.github.com/users/e2ac67/following{/other_user}",
|
|
812
|
+
"gists_url": "https://api.github.com/users/e2ac67/gists{/gist_id}",
|
|
813
|
+
"starred_url": "https://api.github.com/users/e2ac67/starred{/owner}{/repo}",
|
|
814
|
+
"subscriptions_url": "https://api.github.com/users/e2ac67/subscriptions",
|
|
815
|
+
"organizations_url": "https://api.github.com/users/e2ac67/orgs",
|
|
816
|
+
"repos_url": "https://api.github.com/users/e2ac67/repos",
|
|
817
|
+
"events_url": "https://api.github.com/users/e2ac67/events{/privacy}",
|
|
818
|
+
"received_events_url": "https://api.github.com/users/e2ac67/received_events",
|
|
819
|
+
"type": "User",
|
|
820
|
+
"site_admin": False,
|
|
821
|
+
"name": None,
|
|
822
|
+
"company": None,
|
|
823
|
+
"blog": "",
|
|
824
|
+
"location": None,
|
|
825
|
+
"email": None,
|
|
826
|
+
"hireable": None,
|
|
827
|
+
"bio": None,
|
|
828
|
+
"twitter_username": None,
|
|
829
|
+
"public_repos": 0,
|
|
830
|
+
"public_gists": 0,
|
|
831
|
+
"followers": 0,
|
|
832
|
+
"following": 0,
|
|
833
|
+
"created_at": "2021-09-24T03:53:02Z",
|
|
834
|
+
"updated_at": "2021-09-24T03:59:40Z",
|
|
835
|
+
},
|
|
836
|
+
)
|
|
837
|
+
responses.add(
|
|
838
|
+
responses.GET,
|
|
839
|
+
"https://api.github.com/user/orgs",
|
|
840
|
+
json=[],
|
|
841
|
+
)
|
|
842
|
+
responses.add(
|
|
843
|
+
responses.GET,
|
|
844
|
+
"https://api.github.com/user/repos",
|
|
845
|
+
json=[],
|
|
846
|
+
headers={
|
|
847
|
+
"GitHub-Authentication-Token-Expiration": "2021-10-07 19:07:53 UTC",
|
|
848
|
+
"X-OAuth-Scopes": "gist, repo",
|
|
849
|
+
},
|
|
850
|
+
)
|
|
851
|
+
updated_dict = validate_service(service_dict, keychain_enterprise)
|
|
852
|
+
expected_dict = {
|
|
853
|
+
"username": "e2ac67",
|
|
854
|
+
"token": "ghp_cf83e1357eefb8bdf1542850d66d8007d620e4",
|
|
855
|
+
"email": "testerson@test.com",
|
|
856
|
+
"Organizations": "",
|
|
857
|
+
"scopes": "gist, repo",
|
|
858
|
+
"expires": "2021-10-07 19:07:53 UTC",
|
|
859
|
+
}
|
|
860
|
+
assert expected_dict == updated_dict
|
|
861
|
+
|
|
862
|
+
@responses.activate
|
|
863
|
+
def test_validate_bad_auth(self, keychain_enterprise):
|
|
864
|
+
service_dict = {
|
|
865
|
+
"username": "e2ac67",
|
|
866
|
+
"token": "bad_cf83e1357eefb8bdf1542850d66d8007d620e4",
|
|
867
|
+
"email": "testerson@test.com",
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
responses.add(
|
|
871
|
+
responses.GET,
|
|
872
|
+
"https://api.github.com/user",
|
|
873
|
+
json={
|
|
874
|
+
"message": "Bad credentials",
|
|
875
|
+
"documentation_url": "https://docs.github.com/rest",
|
|
876
|
+
},
|
|
877
|
+
status=401,
|
|
878
|
+
)
|
|
879
|
+
|
|
880
|
+
with pytest.raises(cumulusci.core.exceptions.GithubException) as e:
|
|
881
|
+
validate_service(service_dict, keychain_enterprise)
|
|
882
|
+
assert "401" in str(e.value)
|
|
883
|
+
|
|
884
|
+
@mock.patch("webbrowser.open")
|
|
885
|
+
@mock.patch("cumulusci.core.github.get_device_code")
|
|
886
|
+
@mock.patch("cumulusci.core.github.get_device_oauth_token", autospec=True)
|
|
887
|
+
def test_get_oauth_device_flow_token(
|
|
888
|
+
self,
|
|
889
|
+
get_token,
|
|
890
|
+
get_code,
|
|
891
|
+
browser_open,
|
|
892
|
+
):
|
|
893
|
+
device_config = {
|
|
894
|
+
"device_code": "36482450e39b7f27d9a145a96898d29365a4e73f",
|
|
895
|
+
"user_code": "3E15-9D06",
|
|
896
|
+
"verification_uri": "https://github.com/login/device",
|
|
897
|
+
"expires_in": 899,
|
|
898
|
+
"interval": 5,
|
|
899
|
+
}
|
|
900
|
+
get_code.return_value = device_config
|
|
901
|
+
get_token.return_value = {
|
|
902
|
+
"access_token": "expected_access_token",
|
|
903
|
+
"token_type": "bearer",
|
|
904
|
+
"scope": "gist,repo",
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
returned_token = get_oauth_device_flow_token()
|
|
908
|
+
|
|
909
|
+
assert returned_token == "expected_access_token"
|
|
910
|
+
get_token.assert_called_once()
|
|
911
|
+
get_code.assert_called_once()
|
|
912
|
+
browser_open.assert_called_with("https://github.com/login/device")
|
|
913
|
+
|
|
914
|
+
@responses.activate
|
|
915
|
+
@pytest.mark.parametrize(
|
|
916
|
+
("base_url", "endpoint"),
|
|
917
|
+
(
|
|
918
|
+
("https://api.github.com", "https://api.github.com/graphql"),
|
|
919
|
+
(
|
|
920
|
+
"https://github.enterprise.server/api/v3",
|
|
921
|
+
"https://github.enterprise.server/api/graphql",
|
|
922
|
+
),
|
|
923
|
+
),
|
|
924
|
+
)
|
|
925
|
+
def test_get_latest_prerelease(self, base_url, endpoint):
|
|
926
|
+
expected_tag = "beta/1.0-Beta_1"
|
|
927
|
+
query_result = self._get_expected_prerelease_tag_gql(expected_tag)
|
|
928
|
+
|
|
929
|
+
responses.add(
|
|
930
|
+
"POST",
|
|
931
|
+
endpoint,
|
|
932
|
+
json=query_result,
|
|
933
|
+
)
|
|
934
|
+
|
|
935
|
+
repo: Repository = mock.MagicMock()
|
|
936
|
+
repo.session = mock.MagicMock()
|
|
937
|
+
repo.session.base_url = base_url
|
|
938
|
+
repo.session.request = requests.request
|
|
939
|
+
|
|
940
|
+
get_latest_prerelease(repo=repo)
|
|
941
|
+
assert responses.assert_call_count(endpoint, 1)
|
|
942
|
+
repo.release_from_tag.assert_called_once_with(expected_tag)
|