Skip to content

Commit

Permalink
Merge branch 'main' into pdf-doc-author
Browse files Browse the repository at this point in the history
  • Loading branch information
jstvz authored May 13, 2024
2 parents a5f30ca + 31f2873 commit 1d7864a
Show file tree
Hide file tree
Showing 168 changed files with 7,963 additions and 1,540 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/chores.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
' cumulusci/cumulusci.yml
- name: Commit changes
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git switch -c "update-sfdc-api-v$VERSION"
git add cumulusci/cumulusci.yml
git commit -m "Automated update to sfdc API version $VERSION"
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/feature_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, sfdc-ubuntu-latest, sfdc-windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
exclude: # FIXME: Remove when lxml publishes a 311-windows wheel
- os: sfdc-windows-latest
python-version: "3.11"
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
- os: macos-latest
python-version: 3.8
include:
- os: macos-13
python-version: 3.8
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand Down Expand Up @@ -74,7 +77,7 @@ jobs:
- name: Install sfdx
run: |
mkdir sfdx
wget -qO- https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz | tar xJ -C sfdx --strip-components 1
wget -qO- https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-linux-x64.tar.xz | tar xJ -C sfdx --strip-components 1
echo $(realpath sfdx/bin) >> $GITHUB_PATH
- name: Authenticate Dev Hub
run: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ jobs:
sed -e 's_\(https.*\/\)\([0-9]*\)$_[#\2](\1\2)_' \
-e 's_by @\(.*\) in_by [@\1](https://github.com/\1) in_' >> changelog.md
python utility/update-history.py
- name: Lint history
run: |
npm install prettier
npx prettier --write docs/history.md
- name: Commit changes
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git switch -c "release-$(hatch version)"
git add docs/history.md cumulusci/__about__.py
git commit -m "Update changelog (automated)"
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ For example:

* Ed Rivas (jerivas)
* Gustavo Tandeciarz (dcinzona)
* Chandler Anderson (zenibako)
* Ben French (BenjaminFrench)
2 changes: 1 addition & 1 deletion cumulusci/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.78.0"
__version__ = "3.86.1"
18 changes: 15 additions & 3 deletions cumulusci/cli/org.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def calculate_org_days(info):
@pass_runtime(require_project=False, require_keychain=True)
def org_info(runtime, org_name, print_json):
org_name, org_config = runtime.get_org(org_name)
org_config.refresh_oauth_token(runtime.keychain)
org_config.refresh_oauth_token(runtime.keychain, print_json)
console = Console()
if print_json:
click.echo(
Expand All @@ -330,6 +330,7 @@ def org_info(runtime, org_name, print_json):
"instance_url",
"instance_name",
"is_sandbox",
"namespace",
"namespaced",
"org_id",
"org_type",
Expand Down Expand Up @@ -562,9 +563,20 @@ def org_remove(runtime, org_name, global_org):
@click.option(
"--no-password", is_flag=True, help="If set, don't set a password for the org"
)
@click.option(
"--release",
help="If provided, specify either previous or preview when creating a scratch org",
)
@pass_runtime(require_keychain=True)
def org_scratch(runtime, config_name, org_name, default, devhub, days, no_password):
def org_scratch(
runtime, config_name, org_name, default, devhub, days, no_password, release=None
):
runtime.check_org_overwrite(org_name)
release_options = ["previous", "preview"]
if release and release not in release_options:
raise click.UsageError(
"Release options value is not valid. Either specify preview or previous."
)

scratch_configs = runtime.project_config.lookup("orgs__scratch")
if not scratch_configs:
Expand All @@ -579,7 +591,7 @@ def org_scratch(runtime, config_name, org_name, default, devhub, days, no_passwo
scratch_config["devhub"] = devhub

runtime.keychain.create_scratch_org(
org_name, config_name, days, set_password=not (no_password)
org_name, config_name, days, set_password=not (no_password), release=release
)

if default:
Expand Down
8 changes: 4 additions & 4 deletions cumulusci/cli/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def callback(*args, **kwargs):
set_global_default = kwargs.pop("default", False)

serv_conf = dict(
(k, v) for k, v in list(kwargs.items()) if v is not None
(k, v.strip()) for k, v in list(kwargs.items()) if v is not None
) # remove None values

# A service can define a callable to validate the service config
Expand Down Expand Up @@ -305,7 +305,7 @@ def service_update(
for attr in attributes:
attr_name, attr_value = attr
if attr_name in service_config.config:
service_config.config[attr_name] = attr_value
service_config.config[attr_name] = attr_value.strip()
attributes_were_updated = True
else:
available_attributes = ", ".join(service_attributes)
Expand All @@ -324,7 +324,7 @@ def service_update(
)
if user_input != "":
attributes_were_updated = True
service_config.config[attr] = user_input
service_config.config[attr] = user_input.strip()

if attributes_were_updated:
runtime.keychain.set_service(service_type, service_name, service_config)
Expand Down Expand Up @@ -371,7 +371,7 @@ def get_service_data(service_config, sensitive_attributes) -> list:
click.style(k, bold=True),
(
(v[:5] + (len(v[5:]) * "*") if len(v) > 10 else "*" * len(v))
if k in sensitive_attributes
if k in sensitive_attributes and v is not None
else str(v)
),
]
Expand Down
64 changes: 51 additions & 13 deletions cumulusci/cli/tests/test_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
)
from cumulusci.core.keychain import BaseProjectKeychain
from cumulusci.core.tests.utils import MockLookup
from cumulusci.tests.util import CURRENT_SF_API_VERSION
from cumulusci.utils import parse_api_datetime

from .. import org
Expand Down Expand Up @@ -108,7 +109,7 @@ def test_org_connect(self, auth_code_flow):
)
responses.add(
method="GET",
url="https://instance/services/data/v45.0/sobjects/Organization/OODxxxxxxxxxxxx",
url=f"https://instance/services/data/v{CURRENT_SF_API_VERSION}/sobjects/Organization/OODxxxxxxxxxxxx",
json={
"TrialExpirationDate": None,
"OrganizationType": "Developer Edition",
Expand All @@ -118,7 +119,11 @@ def test_org_connect(self, auth_code_flow):
},
status=200,
)
responses.add("GET", "https://instance/services/data", json=[{"version": 45.0}])
responses.add(
"GET",
"https://instance/services/data",
json=[{"version": CURRENT_SF_API_VERSION}],
)

result = run_cli_command("org", "connect", "test", "--default", runtime=runtime)

Expand Down Expand Up @@ -161,7 +166,7 @@ def test_org_connect__non_default_connected_app(self, auth_code_flow):
)
responses.add(
method="GET",
url="https://instance/services/data/v45.0/sobjects/Organization/OODxxxxxxxxxxxx",
url=f"https://instance/services/data/v{CURRENT_SF_API_VERSION}/sobjects/Organization/OODxxxxxxxxxxxx",
json={
"TrialExpirationDate": None,
"OrganizationType": "Developer Edition",
Expand All @@ -171,7 +176,11 @@ def test_org_connect__non_default_connected_app(self, auth_code_flow):
},
status=200,
)
responses.add("GET", "https://instance/services/data", json=[{"version": 45.0}])
responses.add(
"GET",
"https://instance/services/data",
json=[{"version": CURRENT_SF_API_VERSION}],
)

result = run_cli_command(
"org", "connect", "test", "--connected_app", "other", runtime=runtime
Expand Down Expand Up @@ -288,7 +297,7 @@ def test_org_connect_expires(self, oauth2client):
)
responses.add(
method="GET",
url="https://instance/services/data/v45.0/sobjects/Organization/OODxxxxxxxxxxxx",
url=f"https://instance/services/data/v{CURRENT_SF_API_VERSION}/sobjects/Organization/OODxxxxxxxxxxxx",
json={
"TrialExpirationDate": "1970-01-01T12:34:56.000+0000",
"OrganizationType": "Developer Edition",
Expand All @@ -298,7 +307,11 @@ def test_org_connect_expires(self, oauth2client):
},
status=200,
)
responses.add("GET", "https://instance/services/data", json=[{"version": 45.0}])
responses.add(
"GET",
"https://instance/services/data",
json=[{"version": CURRENT_SF_API_VERSION}],
)

run_click_command(
org.org_connect,
Expand Down Expand Up @@ -415,11 +428,11 @@ def test_org_import__persistent_org(self, cmd):
method="GET",
url="https://instance/services/data",
status=200,
json=[{"version": "54.0"}],
json=[{"version": CURRENT_SF_API_VERSION}],
)
responses.add(
method="GET",
url="https://instance/services/data/v54.0/sobjects/Organization/OODxxxxxxxxxxxx",
url=f"https://instance/services/data/v{CURRENT_SF_API_VERSION}/sobjects/Organization/OODxxxxxxxxxxxx",
json={
"TrialExpirationDate": None,
"OrganizationType": "Developer Edition",
Expand Down Expand Up @@ -470,11 +483,11 @@ def test_org_import__trial_org(self, cmd):
method="GET",
url="https://instance/services/data",
status=200,
json=[{"version": "54.0"}],
json=[{"version": CURRENT_SF_API_VERSION}],
)
responses.add(
method="GET",
url="https://instance/services/data/v54.0/sobjects/Organization/OODxxxxxxxxxxxx",
url=f"https://instance/services/data/v{CURRENT_SF_API_VERSION}/sobjects/Organization/OODxxxxxxxxxxxx",
json={
"TrialExpirationDate": api_datetime,
"OrganizationType": "Developer Edition",
Expand Down Expand Up @@ -540,6 +553,7 @@ def test_org_info(self):
"default": True,
"password": None,
"connected_app": "built-in",
"namespace": "test",
}
org_config.expires = date.today()
org_config.latest_api_version = "42.0"
Expand All @@ -557,6 +571,7 @@ def test_org_info(self):
["\x1b[1mconnected_app\x1b[0m", "built-in"],
["\x1b[1mdays\x1b[0m", "1"],
["\x1b[1mdefault\x1b[0m", "True"],
["\x1b[1mnamespace\x1b[0m", "test"],
["\x1b[1mpassword\x1b[0m", "None"],
],
)
Expand Down Expand Up @@ -1247,20 +1262,40 @@ def test_org_scratch(self):
devhub="hub",
days=7,
no_password=True,
release="previous",
)

runtime.check_org_overwrite.assert_called_once()
runtime.keychain.create_scratch_org.assert_called_with(
"test", "dev", 7, set_password=False
"test", "dev", 7, set_password=False, release="previous"
)
runtime.keychain.set_default_org.assert_called_with("test")

def test_org_scratch__not_default(self):
def test_org_scratch_release_invalid(self):
runtime = mock.Mock()

runtime.project_config.lookup = MockLookup(
orgs__scratch={"dev": {"orgName": "Dev"}}
)
with pytest.raises(click.UsageError):
run_click_command(
org.org_scratch,
runtime=runtime,
config_name="dev",
org_name="test",
default=True,
devhub="hub",
days=7,
no_password=True,
release="next",
)
runtime.check_org_overwrite.assert_called_once()

def test_org_scratch__not_default(self):
runtime = mock.Mock()
runtime.project_config.lookup = MockLookup(
orgs__scratch={"dev": {"orgName": "Dev"}}
)
run_click_command(
org.org_scratch,
runtime=runtime,
Expand All @@ -1270,11 +1305,12 @@ def test_org_scratch__not_default(self):
devhub="hub",
days=7,
no_password=True,
release=None,
)

runtime.check_org_overwrite.assert_called_once()
runtime.keychain.create_scratch_org.assert_called_with(
"test", "dev", 7, set_password=False
"test", "dev", 7, set_password=False, release=None
)

def test_org_scratch_no_configs(self):
Expand All @@ -1291,6 +1327,7 @@ def test_org_scratch_no_configs(self):
devhub="hub",
days=7,
no_password=True,
release="previous",
)

def test_org_scratch_config_not_found(self):
Expand All @@ -1307,6 +1344,7 @@ def test_org_scratch_config_not_found(self):
devhub="hub",
days=7,
no_password=True,
release="previous",
)

def test_org_scratch_delete(self):
Expand Down
2 changes: 1 addition & 1 deletion cumulusci/cli/tests/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_plan_list(self, cli_table, runtime):

run_click_command(plan.plan_list, runtime=runtime, print_json=False)

cli_table.called_once_with(
cli_table.assert_called_once_with(
data=[
["Name", "Title", "Slug", "Tier"],
["plan 1", "Test Plan #1", "plan1_slug", "primary"],
Expand Down
Loading

0 comments on commit 1d7864a

Please sign in to comment.