Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ProvisioningProfile.team_identifier type interface #440

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 0.54.4
-------------

**Bugfixes**
- Fix `team_identifier` property on `codemagic.models.ProvisioningProfile` to always return a string as the type hint suggests. [PR #440](https://github.com/codemagic-ci-cd/cli-tools/pull/440)

Version 0.54.3
-------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "codemagic-cli-tools"
version = "0.54.3"
version = "0.54.4"
description = "CLI tools used in Codemagic builds"
readme = "README.md"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion src/codemagic/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = "codemagic-cli-tools"
__description__ = "CLI tools used in Codemagic builds"
__version__ = "0.54.3.dev"
__version__ = "0.54.4.dev"
__url__ = "https://github.com/codemagic-ci-cd/cli-tools"
__licence__ = "GNU General Public License v3.0"
3 changes: 2 additions & 1 deletion src/codemagic/models/provisioning_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def uuid(self) -> str:

@property
def team_identifier(self) -> str:
return self._plist.get("TeamIdentifier", [None])[0]
team_identifiers = self._plist.get("TeamIdentifier") or [""]
return team_identifiers[0]

@property
def team_name(self) -> str:
Expand Down
15 changes: 15 additions & 0 deletions tests/models/test_provisioning_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,18 @@ def test_profile_creation_date(provisioning_profile):
def test_profile_expiration_date(provisioning_profile):
expected_expiration_date = datetime(2023, 3, 24, 10, 2, 42, tzinfo=timezone.utc)
assert provisioning_profile.expiration_date == expected_expiration_date


@pytest.mark.parametrize(
"profile_plist",
(
{},
{"TeamIdentifier": []},
{"TeamIdentifier": None},
{"TeamIdentifier": ""},
{"TeamIdentifier": [""]},
),
)
def test_missing_team_identifier(profile_plist):
provisioning_profile = ProvisioningProfile(profile_plist)
assert provisioning_profile.team_identifier == ""
Loading