Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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,
    )
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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")
Ejemplo n.º 5
0
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,
    )
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
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
Ejemplo n.º 8
0
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])
Ejemplo n.º 9
0
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
Ejemplo n.º 10
0
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
Ejemplo n.º 11
0
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, "")
Ejemplo n.º 12
0
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)
Ejemplo n.º 13
0
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,
    )
Ejemplo n.º 14
0
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)
Ejemplo n.º 15
0
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
Ejemplo n.º 16
0
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
Ejemplo n.º 17
0
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)
Ejemplo n.º 18
0
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
Ejemplo n.º 19
0
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
Ejemplo n.º 20
0
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
Ejemplo n.º 21
0
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"},
    )
Ejemplo n.º 22
0
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,
    )
Ejemplo n.º 23
0
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
Ejemplo n.º 24
0
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)
Ejemplo n.º 25
0
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,
    )
Ejemplo n.º 26
0
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]
Ejemplo n.º 27
0
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