コード例 #1
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_set_beta_groups_detail() -> None:
    """Test that we can get a builds beta details."""
    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

    build = client.build.get_from_build_number(build_number="",
                                               bundle_id=APP_ID)

    assert build is not None

    groups = [
        group for group in client.beta_review.get_beta_groups(app.identifier)
        if group.attributes.name in
        ["External Testers", "Public Link Testers"]
    ]

    client.beta_review.set_beta_groups_on_build(build.identifier, groups)
コード例 #2
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_create_screenshot_set() -> None:
    """Test that we can create a screenshot set."""
    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.version.get_version(app_id=app.identifier,
                                         version_string="1.2.3")
    assert version is not None

    localizations = list(
        client.version.get_localizations(version_id=version.identifier))

    en_us = [
        localization for localization in localizations
        if localization.attributes.locale == "en-US"
    ][0]

    client.screenshots.create_set(
        localization_id=en_us.identifier,
        display_type=asconnect.models.ScreenshotDisplayType.app_iphone_65,
    )
コード例 #3
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_get_screenshots() -> None:
    """Test that we can get screenshot sets from 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.version.get_version(app_id=app.identifier,
                                         version_string="1.2.3")
    assert version is not None

    localizations = list(
        client.version.get_localizations(version_id=version.identifier))
    assert len(localizations) > 0

    en_us = [
        localization for localization in localizations
        if localization.attributes.locale == "en-US"
    ][0]

    screenshot_set = list(
        client.screenshots.get_sets(localization_id=en_us.identifier))[0]

    screenshots = list(
        client.screenshots.get_screenshots(
            screenshot_set_id=screenshot_set.identifier))
    assert len(screenshots) > 0
コード例 #4
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_upload_all_screenshots() -> None:
    """Test that we can upload all screenshots."""
    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.version.get_version(app_id=app.identifier,
                                         version_string="1.2.3")
    assert version is not None

    root_screenshots_path = "/path/to/screenshots"

    for localization in client.version.get_localizations(
            version_id=version.identifier):
        upload_screenshots_for_localization(localization,
                                            root_screenshots_path, client)

    print("Done")
コード例 #5
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_set_idfa() -> None:
    """Set the advertising ID declaration"""

    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("com.microsoft.Office.Outlook")
    assert app is not None

    version = client.version.get_version(app_id=app.identifier, version_string="4.2135.0")
    assert version is not None

    client.version.set_uses_idfa(version_id=version.identifier)

    _ = client.version.get_idfa(version_id=version.identifier)

    client.version.set_idfa(
        version_id=version.identifier,
        attributes_action_with_previous_ad=True,
        attributes_app_installation_to_previous_ad=True,
        honors_limited_ad_tracking=True,
        serves_ads=True,
    )
コード例 #6
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_get_app() -> None:
    """Test that we can get an app."""
    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
コード例 #7
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_get_builds() -> None:
    """Test get apps."""
    key_id, key_contents, issuer_id = get_test_data()

    client = asconnect.Client(
        key_id=key_id,
        key_contents=key_contents,
        issuer_id=issuer_id,
    )
    builds = client.build.get_builds()
    assert builds is not None
コード例 #8
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_get_apps() -> None:
    """Test get apps."""
    key_id, key_contents, issuer_id = get_test_data()

    client = asconnect.Client(
        key_id=key_id,
        key_contents=key_contents,
        issuer_id=issuer_id,
    )
    apps = list(client.app.get_all())
    assert len(apps) != 0
    print(apps[0])
コード例 #9
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_get_builds_by_version() -> None:
    """Test get build by 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
    builds = next(client.build.get_builds(app_id=app.identifier))
    assert builds is not None
コード例 #10
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_get_users() -> None:
    """Test that we can upload all screenshots."""
    key_id, key_contents, issuer_id = get_test_data()

    client = asconnect.Client(
        key_id=key_id,
        key_contents=key_contents,
        issuer_id=issuer_id,
    )

    users = list(client.users.get_users())

    assert len(users) > 0
コード例 #11
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_wait_for_build() -> None:
    """Test that we can wait for a build."""
    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

    client.build.wait_for_build_to_process(APP_ID, "")
コード例 #12
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_create_new_version() -> 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

    client.app.create_new_version(version="1.2.3", app_id=app.identifier)
コード例 #13
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_upload() -> None:
    """Test that we can upload a build."""
    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.build.upload(
        ipa_path=IPA_PATH,
        platform=asconnect.Platform.IOS,
    )
コード例 #14
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_beta_review_submission() -> None:
    """Test that we can submit a build for beta review."""
    key_id, key_contents, issuer_id = get_test_data()

    client = asconnect.Client(
        key_id=key_id,
        key_contents=key_contents,
        issuer_id=issuer_id,
    )

    build = client.build.get_from_build_number(build_number="", bundle_id=APP_ID)

    assert build is not None

    client.beta_review.submit_for_beta_review(build.identifier)
コード例 #15
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_get_version() -> 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,
    )

    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="1.2.3")
    assert version is not None
コード例 #16
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_get_build_localization_details() -> None:
    """Test that we can get a builds localization details."""
    key_id, key_contents, issuer_id = get_test_data()

    client = asconnect.Client(
        key_id=key_id,
        key_contents=key_contents,
        issuer_id=issuer_id,
    )

    build = client.build.get_from_build_number(build_number="", bundle_id=APP_ID)

    assert build is not None

    assert len(list(client.beta_review.get_beta_build_localizations(build.identifier))) > 0
コード例 #17
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_get_beta_app_localizations() -> None:
    """Test get beta app localizations."""
    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

    client.beta_review.get_beta_app_localizations(app.identifier)
コード例 #18
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_get_versions() -> None:
    """Test that we can get app store versions."""
    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

    versions = list(client.version.get_all(app_id=app.identifier))
    assert len(versions) > 0
コード例 #19
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_get_build_beta_detail() -> None:
    """Test that we can get a builds beta details."""
    key_id, key_contents, issuer_id = get_test_data()

    client = asconnect.Client(
        key_id=key_id,
        key_contents=key_contents,
        issuer_id=issuer_id,
    )

    build = client.build.get_from_build_number(build_number="", bundle_id=APP_ID)

    assert build is not None

    build_detail = client.build.get_beta_detail(build)

    assert build_detail is not None
コード例 #20
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
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 is asconnect.models.PhasedReleaseState.INACTIVE
コード例 #21
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_set_whats_new() -> None:
    """Test that we can get a builds localization details."""
    key_id, key_contents, issuer_id = get_test_data()

    client = asconnect.Client(
        key_id=key_id,
        key_contents=key_contents,
        issuer_id=issuer_id,
    )

    build = client.build.get_from_build_number(build_number="", bundle_id=APP_ID)

    assert build is not None

    client.beta_review.set_whats_new_for_build(
        build.identifier,
        {"en-US": "Bug fixes and performance improvements"},
    )
コード例 #22
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_upload() -> None:
    """Test that we can upload a build."""
    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

    asconnect.upload_build(
        ipa_path=IPA_PATH,
        bundle_id=APP_ID,
        app_id=app.identifier,
        username=USERNAME,
        password=PASSWORD,
    )
コード例 #23
0
ファイル: test_asconnect.py プロジェクト: microsoft/asconnect
def test_delete_screenshot_sets() -> None:
    """Test that we can delete screenshot sets from 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.version.get_version(app_id=app.identifier, version_string="1.2.3")
    assert version is not None

    for localization in client.version.get_localizations(version_id=version.identifier):
        client.screenshots.delete_all_sets_in_localization(localization_id=localization.identifier)

    assert version is not None
コード例 #24
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_set_testflight_localized_review_details() -> None:
    """Test that we can set the testflight app review details."""
    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

    info = {
        "en-US": {
            "feedbackEmail": "*****@*****.**",
            "description": "Thanks for helping us test!",
        }
    }

    client.beta_review.set_beta_app_localizations(app.identifier, info)
コード例 #25
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_set_testflight_review_details() -> None:
    """Test that we can set the testflight app review details."""
    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

    client.beta_review.set_beta_app_review_details(
        app_id=app.identifier,
        contact_email="*****@*****.**",
        contact_first_name="John",
        contact_last_name="Doe",
        contact_phone="1-425-867-5309",
        demo_account_name="*****@*****.**",
        demo_account_password="******",
        demo_account_required=True,
    )
コード例 #26
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_get_app_info_localization() -> None:
    """Test that we can get app info localization."""
    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.version.get_version(app_id=app.identifier,
                                         version_string="1.2.3")
    assert version is not None

    app_infos = client.app_info.get_app_info(app_id=app.identifier)
    app_info = [
        app_info for app_info in app_infos
        if app_info.attributes.app_store_state !=
        asconnect.models.AppStoreVersionState.ready_for_sale
    ][0]
コード例 #27
0
ファイル: test_asconnect.py プロジェクト: fiannaca/asconnect
def test_token() -> None:
    """Test the JWT token generation"""

    key_id, key_contents, issuer_id = get_test_data()

    client = asconnect.Client(
        key_id=key_id,
        key_contents=key_contents,
        issuer_id=issuer_id,
    )

    token = client.http_client.generate_token()

    decoded = jwt.decode(token, verify=False)
    assert decoded["iss"] == issuer_id
    assert decoded["aud"] == "appstoreconnect-v1"
    assert datetime.datetime.fromtimestamp(
        decoded["exp"]) < datetime.datetime.now() + datetime.timedelta(
            minutes=20)

    # Ensure we return the cached version
    token2 = client.http_client.generate_token()
    assert token == token2