forked from SFDO-Tooling/CumulusCI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request SFDO-Tooling#3669 from SFDO-Tooling/feature/listme…
…tadatatypes Feature/listmetadatatypes
- Loading branch information
Showing
8 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from cumulusci.salesforce_api.metadata import ApiListMetadataTypes | ||
from cumulusci.tasks.salesforce import BaseRetrieveMetadata | ||
|
||
|
||
class DescribeMetadataTypes(BaseRetrieveMetadata): | ||
api_class = ApiListMetadataTypes | ||
task_options = { | ||
"api_version": { | ||
"description": "Override the API version used to list metadatatypes" | ||
}, | ||
} | ||
|
||
def _init_options(self, kwargs): | ||
super(DescribeMetadataTypes, self)._init_options(kwargs) | ||
if "api_version" not in self.options: | ||
self.options[ | ||
"api_version" | ||
] = self.project_config.project__package__api_version | ||
|
||
def _get_api(self): | ||
return self.api_class(self, self.options.get("api_version")) | ||
|
||
def _run_task(self): | ||
api_object = self._get_api() | ||
metadata_list = api_object() | ||
self.logger.info("Metadata Types supported by org:\n" + str(metadata_list)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
cumulusci/tasks/salesforce/tests/test_describemetadatatypes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from unittest import mock | ||
|
||
from cumulusci.tasks.salesforce import DescribeMetadataTypes | ||
|
||
from .util import create_task | ||
|
||
|
||
class TestRetrieveMetadataTypes: | ||
def test_run_task(self): | ||
task = create_task(DescribeMetadataTypes) | ||
task._get_api = mock.Mock() | ||
task() | ||
task._get_api.assert_called_once() | ||
|
||
def test_run_task_with_apiversion(self): | ||
task = create_task(DescribeMetadataTypes, {"api_version": 8.0}) | ||
assert task.options.get("api_version") == 8.0 | ||
task._get_api() |