зеркало из https://github.com/microsoft/asconnect.git
phased release refinements
This commit is contained in:
Родитель
9bb4637178
Коммит
259eeb27ea
|
@ -75,8 +75,8 @@ It's that easy. Most of the time at least. If you don't have previous version to
|
|||
# Create a new version
|
||||
version = client.app.create_new_version(version="1.2.3", app_id=app.identifier)
|
||||
|
||||
# Start a versions' phased release
|
||||
phased_release = client.version.create_phased_release(version_id=version.identifier, phased_release_state=PhasedReleaseState.active)
|
||||
# Start a versions' phased release, the initial state of which is INACTIVE
|
||||
phased_release = client.version.create_phased_release(version_id=version.identifier)
|
||||
|
||||
# Check on a phased release
|
||||
phased_release = client.version.get_phased_release(version_id=version.identifier)
|
||||
|
|
|
@ -27,7 +27,7 @@ class ReleaseType(enum.Enum):
|
|||
class PhasedReleaseState(enum.Enum):
|
||||
"""App store phased release state.
|
||||
|
||||
inactive: TODO(?) default state
|
||||
inactive: initial state
|
||||
active: over the course of 7 days the app will be rolled out in randomly selected phases
|
||||
paused: the rollout is paused
|
||||
complete: the rollout is complete
|
||||
|
|
|
@ -96,7 +96,11 @@ class VersionClient:
|
|||
"""
|
||||
return next_or_none(self.get_all(app_id=app_id, version_string=version_string))
|
||||
|
||||
def get_phased_release(self, *, version_id: str,) -> Optional[AppStoreVersionPhasedRelease]:
|
||||
def get_phased_release(
|
||||
self,
|
||||
*,
|
||||
version_id: str,
|
||||
) -> Optional[AppStoreVersionPhasedRelease]:
|
||||
"""Get the phased release of given app version
|
||||
|
||||
:param version_id: The version ID to query for phased releases
|
||||
|
@ -128,17 +132,21 @@ class VersionClient:
|
|||
endpoint="appStoreVersionPhasedReleases",
|
||||
data={
|
||||
"data": {
|
||||
"attributes": {"phasedReleaseState": phased_release_state},
|
||||
"attributes": {"phasedReleaseState": phased_release_state.value},
|
||||
"type": "appStoreVersionPhasedReleases",
|
||||
"relationships": {
|
||||
"appStoreVersion": {"id": version_id, "type": "appStoreVersions"}
|
||||
"appStoreVersion": {"data": {"id": version_id, "type": "appStoreVersions"}}
|
||||
},
|
||||
}
|
||||
},
|
||||
data_type=AppStoreVersionPhasedRelease,
|
||||
)
|
||||
|
||||
def delete_phased_release(self, *, phased_release_id: str,) -> None:
|
||||
def delete_phased_release(
|
||||
self,
|
||||
*,
|
||||
phased_release_id: str,
|
||||
) -> None:
|
||||
"""Delete a Phased Release
|
||||
|
||||
:param phased_release_id: The ID of the release set to delete
|
||||
|
@ -165,7 +173,7 @@ class VersionClient:
|
|||
endpoint=f"appStoreVersionPhasedReleases/{phased_release_id}",
|
||||
data={
|
||||
"data": {
|
||||
"attributes": {"phasedReleaseState": phased_release_state},
|
||||
"attributes": {"phasedReleaseState": phased_release_state.value},
|
||||
"type": "appStoreVersionPhasedReleases",
|
||||
"id": phased_release_id,
|
||||
}
|
||||
|
|
|
@ -10,6 +10,16 @@ import re
|
|||
import sys
|
||||
from typing import Optional, Tuple, Union
|
||||
|
||||
from asconnect.models import (
|
||||
AppStoreVersion,
|
||||
AppStoreVersionPhasedRelease,
|
||||
PhasedReleaseState,
|
||||
Platform,
|
||||
AppStoreVersionLocalization,
|
||||
AppStoreReviewDetails,
|
||||
IdfaDeclaration,
|
||||
)
|
||||
|
||||
import jwt
|
||||
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..")))
|
||||
|
@ -358,6 +368,26 @@ def test_create_new_version() -> None:
|
|||
client.app.create_new_version(version="1.2.3", app_id=app.identifier)
|
||||
|
||||
|
||||
def test_create_new_phased_release() -> None:
|
||||
"""Test that we can create a new app store version."""
|
||||
key_id, key_contents, issuer_id = get_test_data()
|
||||
|
||||
client = asconnect.Client(
|
||||
key_id=key_id,
|
||||
key_contents=key_contents,
|
||||
issuer_id=issuer_id,
|
||||
)
|
||||
|
||||
app = client.app.get_from_bundle_id(APP_ID)
|
||||
assert app is not None
|
||||
|
||||
version = client.app.create_new_version(version="1.2.3", app_id=app.identifier)
|
||||
release = client.version.create_phased_release(version_id=version.identifier)
|
||||
|
||||
assert release is not None
|
||||
assert release.attributes.phased_release_state.value is "INACTIVE"
|
||||
|
||||
|
||||
def test_get_versions() -> None:
|
||||
"""Test that we can get app store versions."""
|
||||
key_id, key_contents, issuer_id = get_test_data()
|
||||
|
@ -766,22 +796,23 @@ def test_get_versions_phased_release() -> None:
|
|||
"""Test that we can get a specific app store version."""
|
||||
key_id, key_contents, issuer_id = get_test_data()
|
||||
|
||||
client = asconnect.Client(key_id=key_id, key_contents=key_contents, issuer_id=issuer_id,)
|
||||
client = asconnect.Client(
|
||||
key_id=key_id,
|
||||
key_contents=key_contents,
|
||||
issuer_id=issuer_id,
|
||||
)
|
||||
app = client.app.get_from_bundle_id(APP_ID)
|
||||
|
||||
assert app is not None
|
||||
|
||||
version = client.version.get_version(app_id=app.identifier, version_string="4.2122.0")
|
||||
version = client.version.get_version(app_id=app.identifier, version_string="1.2.3")
|
||||
|
||||
assert version is not None
|
||||
|
||||
release = client.version.get_phased_release(version_id=version.identifier)
|
||||
|
||||
assert release is not None
|
||||
assert release.attributes.phased_release_state is not None
|
||||
|
||||
# Phased releases always belong to a release there is no GET v1/appStoreVersionPhasedRelease/{id}
|
||||
# Only PATCH v1/appStoreVersionPhasedRelease/{id} exists
|
||||
assert release.attributes.phased_release_state is not Nones
|
||||
|
||||
|
||||
def load_value(
|
||||
|
|
Загрузка…
Ссылка в новой задаче