cumulusci-plus 5.0.21__py3-none-any.whl → 5.0.35__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.
- cumulusci/__about__.py +1 -1
- cumulusci/cli/logger.py +2 -2
- cumulusci/cli/service.py +20 -0
- cumulusci/cli/task.py +17 -0
- cumulusci/cli/tests/test_error.py +3 -1
- cumulusci/cli/tests/test_flow.py +279 -2
- cumulusci/cli/tests/test_service.py +15 -12
- cumulusci/cli/tests/test_task.py +88 -2
- cumulusci/cli/tests/utils.py +1 -4
- cumulusci/core/config/base_task_flow_config.py +26 -1
- cumulusci/core/config/project_config.py +2 -20
- cumulusci/core/config/tests/test_config_expensive.py +9 -3
- cumulusci/core/config/universal_config.py +3 -4
- cumulusci/core/dependencies/base.py +1 -1
- cumulusci/core/dependencies/dependencies.py +1 -1
- cumulusci/core/dependencies/github.py +1 -2
- cumulusci/core/dependencies/resolvers.py +1 -1
- cumulusci/core/dependencies/tests/test_dependencies.py +1 -1
- cumulusci/core/dependencies/tests/test_resolvers.py +1 -1
- cumulusci/core/flowrunner.py +90 -6
- cumulusci/core/github.py +1 -1
- cumulusci/core/sfdx.py +3 -1
- cumulusci/core/source_transforms/tests/test_transforms.py +1 -1
- cumulusci/core/source_transforms/transforms.py +1 -1
- cumulusci/core/tasks.py +13 -2
- cumulusci/core/tests/test_flowrunner.py +100 -0
- cumulusci/core/tests/test_tasks.py +65 -0
- cumulusci/core/utils.py +3 -1
- cumulusci/core/versions.py +1 -1
- cumulusci/cumulusci.yml +55 -0
- cumulusci/oauth/client.py +1 -1
- cumulusci/plugins/plugin_base.py +5 -3
- cumulusci/robotframework/pageobjects/ObjectManagerPageObject.py +1 -1
- cumulusci/salesforce_api/rest_deploy.py +1 -1
- cumulusci/schema/cumulusci.jsonschema.json +64 -0
- cumulusci/tasks/apex/anon.py +1 -1
- cumulusci/tasks/apex/testrunner.py +416 -142
- cumulusci/tasks/apex/tests/test_apex_tasks.py +917 -1
- cumulusci/tasks/bulkdata/extract.py +0 -1
- cumulusci/tasks/bulkdata/extract_dataset_utils/extract_yml.py +1 -1
- cumulusci/tasks/bulkdata/extract_dataset_utils/synthesize_extract_declarations.py +1 -1
- cumulusci/tasks/bulkdata/extract_dataset_utils/tests/test_extract_yml.py +1 -1
- cumulusci/tasks/bulkdata/generate_and_load_data.py +136 -12
- cumulusci/tasks/bulkdata/mapping_parser.py +139 -44
- cumulusci/tasks/bulkdata/select_utils.py +1 -1
- cumulusci/tasks/bulkdata/snowfakery.py +100 -25
- cumulusci/tasks/bulkdata/tests/test_generate_and_load.py +159 -0
- cumulusci/tasks/bulkdata/tests/test_load.py +0 -2
- cumulusci/tasks/bulkdata/tests/test_mapping_parser.py +763 -1
- cumulusci/tasks/bulkdata/tests/test_select_utils.py +26 -0
- cumulusci/tasks/bulkdata/tests/test_snowfakery.py +133 -0
- cumulusci/tasks/create_package_version.py +190 -16
- cumulusci/tasks/datadictionary.py +1 -1
- cumulusci/tasks/metadata_etl/base.py +7 -3
- cumulusci/tasks/metadata_etl/layouts.py +1 -1
- cumulusci/tasks/metadata_etl/permissions.py +1 -1
- cumulusci/tasks/metadata_etl/remote_site_settings.py +2 -2
- cumulusci/tasks/push/README.md +15 -17
- cumulusci/tasks/release_notes/README.md +13 -13
- cumulusci/tasks/release_notes/generator.py +13 -8
- cumulusci/tasks/robotframework/tests/test_robotframework.py +6 -1
- cumulusci/tasks/salesforce/Deploy.py +53 -2
- cumulusci/tasks/salesforce/SfPackageCommands.py +363 -0
- cumulusci/tasks/salesforce/__init__.py +1 -0
- cumulusci/tasks/salesforce/assign_ps_psg.py +448 -0
- cumulusci/tasks/salesforce/composite.py +1 -1
- cumulusci/tasks/salesforce/custom_settings_wait.py +1 -1
- cumulusci/tasks/salesforce/enable_prediction.py +5 -1
- cumulusci/tasks/salesforce/getPackageVersion.py +89 -0
- cumulusci/tasks/salesforce/sourcetracking.py +1 -1
- cumulusci/tasks/salesforce/tests/test_Deploy.py +316 -1
- cumulusci/tasks/salesforce/tests/test_SfPackageCommands.py +554 -0
- cumulusci/tasks/salesforce/tests/test_assign_ps_psg.py +1055 -0
- cumulusci/tasks/salesforce/tests/test_getPackageVersion.py +651 -0
- cumulusci/tasks/salesforce/tests/test_update_dependencies.py +1 -1
- cumulusci/tasks/salesforce/tests/test_update_external_credential.py +912 -0
- cumulusci/tasks/salesforce/tests/test_update_named_credential.py +1042 -0
- cumulusci/tasks/salesforce/update_dependencies.py +2 -2
- cumulusci/tasks/salesforce/update_external_credential.py +562 -0
- cumulusci/tasks/salesforce/update_named_credential.py +441 -0
- cumulusci/tasks/salesforce/update_profile.py +17 -13
- cumulusci/tasks/salesforce/users/permsets.py +62 -5
- cumulusci/tasks/salesforce/users/tests/test_permsets.py +237 -11
- cumulusci/tasks/sfdmu/__init__.py +0 -0
- cumulusci/tasks/sfdmu/sfdmu.py +363 -0
- cumulusci/tasks/sfdmu/tests/__init__.py +1 -0
- cumulusci/tasks/sfdmu/tests/test_runner.py +212 -0
- cumulusci/tasks/sfdmu/tests/test_sfdmu.py +1012 -0
- cumulusci/tasks/tests/test_create_package_version.py +716 -1
- cumulusci/tasks/tests/test_util.py +42 -0
- cumulusci/tasks/util.py +37 -1
- cumulusci/tasks/utility/copyContents.py +402 -0
- cumulusci/tasks/utility/credentialManager.py +256 -0
- cumulusci/tasks/utility/directoryRecreator.py +30 -0
- cumulusci/tasks/utility/env_management.py +1 -1
- cumulusci/tasks/utility/secretsToEnv.py +135 -0
- cumulusci/tasks/utility/tests/test_copyContents.py +1719 -0
- cumulusci/tasks/utility/tests/test_credentialManager.py +564 -0
- cumulusci/tasks/utility/tests/test_directoryRecreator.py +439 -0
- cumulusci/tasks/utility/tests/test_secretsToEnv.py +1091 -0
- cumulusci/tests/test_integration_infrastructure.py +3 -1
- cumulusci/tests/test_utils.py +70 -6
- cumulusci/utils/__init__.py +54 -9
- cumulusci/utils/classutils.py +5 -2
- cumulusci/utils/http/tests/cassettes/ManualEditTestCompositeParallelSalesforce.test_http_headers.yaml +31 -30
- cumulusci/utils/options.py +23 -1
- cumulusci/utils/parallel/task_worker_queues/parallel_worker.py +1 -1
- cumulusci/utils/yaml/cumulusci_yml.py +7 -3
- cumulusci/utils/yaml/model_parser.py +2 -2
- cumulusci/utils/yaml/tests/test_cumulusci_yml.py +1 -1
- cumulusci/utils/yaml/tests/test_model_parser.py +3 -3
- cumulusci/vcs/base.py +23 -15
- cumulusci/vcs/bootstrap.py +5 -4
- cumulusci/vcs/utils/list_modified_files.py +189 -0
- cumulusci/vcs/utils/tests/test_list_modified_files.py +588 -0
- {cumulusci_plus-5.0.21.dist-info → cumulusci_plus-5.0.35.dist-info}/METADATA +12 -10
- {cumulusci_plus-5.0.21.dist-info → cumulusci_plus-5.0.35.dist-info}/RECORD +121 -96
- {cumulusci_plus-5.0.21.dist-info → cumulusci_plus-5.0.35.dist-info}/WHEEL +0 -0
- {cumulusci_plus-5.0.21.dist-info → cumulusci_plus-5.0.35.dist-info}/entry_points.txt +0 -0
- {cumulusci_plus-5.0.21.dist-info → cumulusci_plus-5.0.35.dist-info}/licenses/AUTHORS.rst +0 -0
- {cumulusci_plus-5.0.21.dist-info → cumulusci_plus-5.0.35.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,10 +6,11 @@ from unittest import mock
|
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
8
|
|
|
9
|
+
from cumulusci.core.config import BaseProjectConfig, UniversalConfig
|
|
9
10
|
from cumulusci.core.exceptions import TaskOptionsError
|
|
10
11
|
from cumulusci.core.flowrunner import StepSpec
|
|
11
12
|
from cumulusci.core.source_transforms.transforms import CleanMetaXMLTransform
|
|
12
|
-
from cumulusci.tasks.salesforce import Deploy
|
|
13
|
+
from cumulusci.tasks.salesforce import Deploy, DeployUnpackagedMetadata
|
|
13
14
|
from cumulusci.utils import temporary_dir, touch
|
|
14
15
|
|
|
15
16
|
from .util import create_task
|
|
@@ -468,3 +469,317 @@ class TestDeploy:
|
|
|
468
469
|
)
|
|
469
470
|
|
|
470
471
|
assert all(s["kind"] == "metadata" for s in task.freeze(step))
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
class TestDeployUnpackagedMetadata:
|
|
475
|
+
@mock.patch(
|
|
476
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
477
|
+
)
|
|
478
|
+
def test_task_options_excludes_path(self, mock_org_config):
|
|
479
|
+
"""Test that path is removed from task_options."""
|
|
480
|
+
assert "path" not in DeployUnpackagedMetadata.task_options
|
|
481
|
+
# Verify other options are still present
|
|
482
|
+
assert "check_only" in DeployUnpackagedMetadata.task_options
|
|
483
|
+
assert "namespace_inject" in DeployUnpackagedMetadata.task_options
|
|
484
|
+
|
|
485
|
+
@mock.patch(
|
|
486
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
487
|
+
)
|
|
488
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.consolidate_metadata")
|
|
489
|
+
def test_init_options_sets_path_from_consolidate_metadata(
|
|
490
|
+
self, mock_consolidate, mock_org_config
|
|
491
|
+
):
|
|
492
|
+
"""Test that _init_options sets path using consolidate_metadata."""
|
|
493
|
+
with temporary_dir() as path:
|
|
494
|
+
mock_consolidate.return_value = (path, 1)
|
|
495
|
+
universal_config = UniversalConfig()
|
|
496
|
+
project_config = BaseProjectConfig(
|
|
497
|
+
universal_config,
|
|
498
|
+
config={"noyaml": True, "project": {"package": {}}},
|
|
499
|
+
repo_info={"root": path},
|
|
500
|
+
)
|
|
501
|
+
project_config.project__package__unpackaged_metadata_path = "unpackaged/pre"
|
|
502
|
+
|
|
503
|
+
task = create_task(
|
|
504
|
+
DeployUnpackagedMetadata,
|
|
505
|
+
{"unmanaged": True},
|
|
506
|
+
project_config=project_config,
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
mock_consolidate.assert_called_once_with("unpackaged/pre", path)
|
|
510
|
+
assert task.options["path"] == path
|
|
511
|
+
|
|
512
|
+
@mock.patch(
|
|
513
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
514
|
+
)
|
|
515
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.consolidate_metadata")
|
|
516
|
+
def test_init_options_calls_consolidate_metadata_with_correct_params(
|
|
517
|
+
self, mock_consolidate, mock_org_config
|
|
518
|
+
):
|
|
519
|
+
"""Test that consolidate_metadata is called with correct parameters."""
|
|
520
|
+
with temporary_dir() as path:
|
|
521
|
+
consolidated_path = os.path.join(path, "consolidated")
|
|
522
|
+
os.makedirs(consolidated_path)
|
|
523
|
+
mock_consolidate.return_value = (consolidated_path, 5)
|
|
524
|
+
|
|
525
|
+
repo_root = "/repo/root"
|
|
526
|
+
universal_config = UniversalConfig()
|
|
527
|
+
project_config = BaseProjectConfig(
|
|
528
|
+
universal_config,
|
|
529
|
+
config={"noyaml": True, "project": {"package": {}}},
|
|
530
|
+
repo_info={"root": repo_root},
|
|
531
|
+
)
|
|
532
|
+
project_config.project__package__unpackaged_metadata_path = "unpackaged/pre"
|
|
533
|
+
|
|
534
|
+
task = create_task(
|
|
535
|
+
DeployUnpackagedMetadata,
|
|
536
|
+
{"unmanaged": True},
|
|
537
|
+
project_config=project_config,
|
|
538
|
+
)
|
|
539
|
+
|
|
540
|
+
mock_consolidate.assert_called_once_with("unpackaged/pre", repo_root)
|
|
541
|
+
assert task.options["path"] == consolidated_path
|
|
542
|
+
|
|
543
|
+
@mock.patch(
|
|
544
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
545
|
+
)
|
|
546
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.consolidate_metadata")
|
|
547
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.clean_temp_directory")
|
|
548
|
+
def test_run_task_calls_parent_and_cleans_up(
|
|
549
|
+
self, mock_clean_temp, mock_consolidate, mock_org_config
|
|
550
|
+
):
|
|
551
|
+
"""Test that _run_task calls parent's _run_task and cleans up."""
|
|
552
|
+
with temporary_dir() as path:
|
|
553
|
+
touch("package.xml")
|
|
554
|
+
consolidated_path = os.path.join(path, "consolidated")
|
|
555
|
+
os.makedirs(consolidated_path)
|
|
556
|
+
mock_consolidate.return_value = (consolidated_path, 3)
|
|
557
|
+
|
|
558
|
+
universal_config = UniversalConfig()
|
|
559
|
+
project_config = BaseProjectConfig(
|
|
560
|
+
universal_config,
|
|
561
|
+
config={"noyaml": True, "project": {"package": {}}},
|
|
562
|
+
repo_info={"root": path},
|
|
563
|
+
)
|
|
564
|
+
project_config.project__package__unpackaged_metadata_path = "unpackaged/pre"
|
|
565
|
+
|
|
566
|
+
task = create_task(
|
|
567
|
+
DeployUnpackagedMetadata,
|
|
568
|
+
{"unmanaged": True},
|
|
569
|
+
project_config=project_config,
|
|
570
|
+
)
|
|
571
|
+
|
|
572
|
+
# Mock parent's _run_task to avoid actual deployment
|
|
573
|
+
task._get_api = mock.Mock(return_value=mock.Mock())
|
|
574
|
+
task._run_task()
|
|
575
|
+
|
|
576
|
+
# Verify cleanup was called
|
|
577
|
+
mock_clean_temp.assert_called_once_with(consolidated_path)
|
|
578
|
+
|
|
579
|
+
@mock.patch(
|
|
580
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
581
|
+
)
|
|
582
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.consolidate_metadata")
|
|
583
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.clean_temp_directory")
|
|
584
|
+
def test_run_task_cleans_up_on_exception(
|
|
585
|
+
self, mock_clean_temp, mock_consolidate, mock_org_config
|
|
586
|
+
):
|
|
587
|
+
"""Test that cleanup happens even when parent's _run_task raises exception."""
|
|
588
|
+
with temporary_dir() as path:
|
|
589
|
+
consolidated_path = os.path.join(path, "consolidated")
|
|
590
|
+
os.makedirs(consolidated_path)
|
|
591
|
+
mock_consolidate.return_value = (consolidated_path, 2)
|
|
592
|
+
|
|
593
|
+
universal_config = UniversalConfig()
|
|
594
|
+
project_config = BaseProjectConfig(
|
|
595
|
+
universal_config,
|
|
596
|
+
config={"noyaml": True, "project": {"package": {}}},
|
|
597
|
+
repo_info={"root": path},
|
|
598
|
+
)
|
|
599
|
+
project_config.project__package__unpackaged_metadata_path = "unpackaged/pre"
|
|
600
|
+
|
|
601
|
+
task = create_task(
|
|
602
|
+
DeployUnpackagedMetadata,
|
|
603
|
+
{"unmanaged": True},
|
|
604
|
+
project_config=project_config,
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
# Mock parent's _run_task to raise an exception
|
|
608
|
+
task._get_api = mock.Mock(side_effect=Exception("Test exception"))
|
|
609
|
+
|
|
610
|
+
with pytest.raises(Exception, match="Test exception"):
|
|
611
|
+
task._run_task()
|
|
612
|
+
|
|
613
|
+
# Verify cleanup was still called despite exception
|
|
614
|
+
mock_clean_temp.assert_called_once_with(consolidated_path)
|
|
615
|
+
|
|
616
|
+
@mock.patch(
|
|
617
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
618
|
+
)
|
|
619
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.consolidate_metadata")
|
|
620
|
+
def test_init_options_inherits_parent_options(
|
|
621
|
+
self, mock_consolidate, mock_org_config
|
|
622
|
+
):
|
|
623
|
+
"""Test that _init_options properly calls parent's _init_options."""
|
|
624
|
+
with temporary_dir() as path:
|
|
625
|
+
consolidated_path = os.path.join(path, "consolidated")
|
|
626
|
+
os.makedirs(consolidated_path)
|
|
627
|
+
mock_consolidate.return_value = (consolidated_path, 4)
|
|
628
|
+
|
|
629
|
+
universal_config = UniversalConfig()
|
|
630
|
+
project_config = BaseProjectConfig(
|
|
631
|
+
universal_config,
|
|
632
|
+
config={"noyaml": True, "project": {"package": {}}},
|
|
633
|
+
repo_info={"root": path},
|
|
634
|
+
)
|
|
635
|
+
project_config.project__package__unpackaged_metadata_path = "unpackaged/pre"
|
|
636
|
+
|
|
637
|
+
task = create_task(
|
|
638
|
+
DeployUnpackagedMetadata,
|
|
639
|
+
{
|
|
640
|
+
"unmanaged": True,
|
|
641
|
+
"check_only": True,
|
|
642
|
+
"test_level": "RunLocalTests",
|
|
643
|
+
},
|
|
644
|
+
project_config=project_config,
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
# Verify parent options were processed
|
|
648
|
+
assert task.check_only is True
|
|
649
|
+
assert task.test_level == "RunLocalTests"
|
|
650
|
+
# Verify path was set from consolidate_metadata
|
|
651
|
+
assert task.options["path"] == consolidated_path
|
|
652
|
+
|
|
653
|
+
@mock.patch(
|
|
654
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
655
|
+
)
|
|
656
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.consolidate_metadata")
|
|
657
|
+
@pytest.mark.parametrize("rest_deploy", [True, False])
|
|
658
|
+
def test_inherits_rest_deploy_option(
|
|
659
|
+
self, mock_consolidate, mock_org_config, rest_deploy
|
|
660
|
+
):
|
|
661
|
+
"""Test that rest_deploy option is properly inherited from parent."""
|
|
662
|
+
with temporary_dir() as path:
|
|
663
|
+
consolidated_path = os.path.join(path, "consolidated")
|
|
664
|
+
os.makedirs(consolidated_path)
|
|
665
|
+
mock_consolidate.return_value = (consolidated_path, 6)
|
|
666
|
+
|
|
667
|
+
universal_config = UniversalConfig()
|
|
668
|
+
project_config = BaseProjectConfig(
|
|
669
|
+
universal_config,
|
|
670
|
+
config={"noyaml": True, "project": {"package": {}}},
|
|
671
|
+
repo_info={"root": path},
|
|
672
|
+
)
|
|
673
|
+
project_config.project__package__unpackaged_metadata_path = "unpackaged/pre"
|
|
674
|
+
|
|
675
|
+
task = create_task(
|
|
676
|
+
DeployUnpackagedMetadata,
|
|
677
|
+
{"unmanaged": True, "rest_deploy": rest_deploy},
|
|
678
|
+
project_config=project_config,
|
|
679
|
+
)
|
|
680
|
+
|
|
681
|
+
assert task.rest_deploy == rest_deploy
|
|
682
|
+
|
|
683
|
+
@mock.patch(
|
|
684
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
685
|
+
)
|
|
686
|
+
@mock.patch("cumulusci.tasks.salesforce.Deploy.consolidate_metadata")
|
|
687
|
+
def test_no_unpackaged_metadata_path(self, mock_consolidate, mock_org_config):
|
|
688
|
+
"""Test that when unpackaged_metadata_path is None, consolidate_metadata is not called and path is not set."""
|
|
689
|
+
with temporary_dir() as path:
|
|
690
|
+
universal_config = UniversalConfig()
|
|
691
|
+
project_config = BaseProjectConfig(
|
|
692
|
+
universal_config,
|
|
693
|
+
config={"noyaml": True, "project": {"package": {}}},
|
|
694
|
+
repo_info={"root": path},
|
|
695
|
+
)
|
|
696
|
+
project_config.project__package__unpackaged_metadata_path = None
|
|
697
|
+
|
|
698
|
+
task = create_task(
|
|
699
|
+
DeployUnpackagedMetadata,
|
|
700
|
+
{},
|
|
701
|
+
project_config=project_config,
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
# Verify consolidate_metadata was not called
|
|
705
|
+
mock_consolidate.assert_not_called()
|
|
706
|
+
# When unpackaged_metadata_path is None, _init_options returns early
|
|
707
|
+
# so parent's _init_options is not called and options may not be initialized
|
|
708
|
+
# or path is not set if options exists
|
|
709
|
+
if hasattr(task, "options"):
|
|
710
|
+
assert "path" not in task.options
|
|
711
|
+
|
|
712
|
+
@mock.patch(
|
|
713
|
+
"cumulusci.core.config.org_config.OrgConfig.installed_packages", return_value=[]
|
|
714
|
+
)
|
|
715
|
+
def test_consolidate_metadata_integration(self, mock_org_config):
|
|
716
|
+
"""Integration test that actually calls consolidate_metadata without mocking."""
|
|
717
|
+
with temporary_dir() as path:
|
|
718
|
+
# Create a realistic metadata structure
|
|
719
|
+
metadata_dir = os.path.join(path, "unpackaged", "pre")
|
|
720
|
+
os.makedirs(metadata_dir)
|
|
721
|
+
|
|
722
|
+
# Create package.xml
|
|
723
|
+
package_xml_path = os.path.join(metadata_dir, "package.xml")
|
|
724
|
+
with open(package_xml_path, "w") as f:
|
|
725
|
+
f.write(
|
|
726
|
+
"""<?xml version="1.0" encoding="UTF-8"?>
|
|
727
|
+
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
728
|
+
<types>
|
|
729
|
+
<members>*</members>
|
|
730
|
+
<name>ApexClass</name>
|
|
731
|
+
</types>
|
|
732
|
+
<version>60.0</version>
|
|
733
|
+
</Package>"""
|
|
734
|
+
)
|
|
735
|
+
|
|
736
|
+
# Create some metadata files
|
|
737
|
+
classes_dir = os.path.join(metadata_dir, "classes")
|
|
738
|
+
os.makedirs(classes_dir)
|
|
739
|
+
|
|
740
|
+
# Create an Apex class
|
|
741
|
+
with open(os.path.join(classes_dir, "TestClass.cls"), "w") as f:
|
|
742
|
+
f.write("public class TestClass { }")
|
|
743
|
+
|
|
744
|
+
# Create an Apex class metadata file
|
|
745
|
+
with open(os.path.join(classes_dir, "TestClass.cls-meta.xml"), "w") as f:
|
|
746
|
+
f.write(
|
|
747
|
+
"""<?xml version="1.0" encoding="UTF-8"?>
|
|
748
|
+
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
749
|
+
<apiVersion>60.0</apiVersion>
|
|
750
|
+
<status>Active</status>
|
|
751
|
+
</ApexClass>"""
|
|
752
|
+
)
|
|
753
|
+
|
|
754
|
+
universal_config = UniversalConfig()
|
|
755
|
+
project_config = BaseProjectConfig(
|
|
756
|
+
universal_config,
|
|
757
|
+
config={"noyaml": True, "project": {"package": {}}},
|
|
758
|
+
repo_info={"root": path},
|
|
759
|
+
)
|
|
760
|
+
project_config.project__package__unpackaged_metadata_path = "unpackaged/pre"
|
|
761
|
+
|
|
762
|
+
# Create task without mocking consolidate_metadata
|
|
763
|
+
task = create_task(
|
|
764
|
+
DeployUnpackagedMetadata,
|
|
765
|
+
{"unmanaged": True},
|
|
766
|
+
project_config=project_config,
|
|
767
|
+
)
|
|
768
|
+
|
|
769
|
+
# Verify that path was set to a temporary directory (not the original)
|
|
770
|
+
assert task.options["path"] != metadata_dir
|
|
771
|
+
# The path should exist
|
|
772
|
+
assert os.path.exists(task.options["path"])
|
|
773
|
+
# The consolidated path should contain our files
|
|
774
|
+
consolidated_package_xml = os.path.join(task.options["path"], "package.xml")
|
|
775
|
+
assert os.path.exists(consolidated_package_xml)
|
|
776
|
+
# Verify the consolidated directory contains the classes directory
|
|
777
|
+
consolidated_classes_dir = os.path.join(task.options["path"], "classes")
|
|
778
|
+
assert os.path.exists(consolidated_classes_dir)
|
|
779
|
+
# Verify our test class exists in consolidated directory
|
|
780
|
+
assert os.path.exists(
|
|
781
|
+
os.path.join(consolidated_classes_dir, "TestClass.cls")
|
|
782
|
+
)
|
|
783
|
+
assert os.path.exists(
|
|
784
|
+
os.path.join(consolidated_classes_dir, "TestClass.cls-meta.xml")
|
|
785
|
+
)
|