Esempio n. 1
0
def test_create_profile_failure_with_devices(profile_type, api_client):
    with pytest.raises(ValueError):
        api_client.profiles.create(
            name='test profile',
            profile_type=profile_type,
            bundle_id=ResourceId('bundle_id_resource_id'),
            certificates=[ResourceId('certificate_resource_id')],
            devices=[ResourceId('device_resource_id')],
        )
Esempio n. 2
0
def test_create_profile_success_with_devices(profile_type, profile_response,
                                             api_client):
    api_client.session.post = mock.Mock(return_value=profile_response)
    api_client.profiles.create(
        name='test profile',
        profile_type=profile_type,
        bundle_id=ResourceId('bundle_id_resource_id'),
        certificates=[ResourceId('certificate_resource_id')],
        devices=[ResourceId('device_resource_id')],
    )
    api_client.session.post.assert_called_once()
 def test_disable_capability_does_not_exist(self):
     capability_id = ResourceId('F88J43FA9J_ACCESS_WIFI_INFORMATION')
     with pytest.raises(AppStoreConnectApiError) as exception_info:
         self.api_client.bundle_id_capabilities.disable(capability_id)
     error = exception_info.value.error_response.errors[0]
     assert error.code == 'NOT_FOUND'
     assert error.status == '404'
Esempio n. 4
0
 def test_read(self):
     app_id = ResourceId('1481211155')
     app = self.api_client.apps.read(app_id)
     print(app.json())
     assert isinstance(app, App)
     assert app.id == app_id
     assert app.type is ResourceType.APPS
Esempio n. 5
0
 def test_list_certificates(self):
     profile_id = ResourceId('M7GU3HQ8CZ')
     certificates = self.api_client.profiles.list_certificates(profile_id)
     assert len(certificates) > 0
     for certificate in certificates:
         assert isinstance(certificate, SigningCertificate)
         assert certificate.type is ResourceType.CERTIFICATES
Esempio n. 6
0
 def test_create(self):
     name = 'test profile'
     profile_type = ProfileType.IOS_APP_DEVELOPMENT
     bundle_id_resource_id = ResourceId('F88J43FA9J')
     certificate_id = ResourceId('29NU422CRF')
     device_ids = [ResourceId('D9PW3SW6K2'), ResourceId('8UCFZA68RK')]
     profile = self.api_client.profiles.create(
         name=name,
         profile_type=profile_type,
         bundle_id=bundle_id_resource_id,
         certificates=[certificate_id],
         devices=device_ids,
     )
     assert isinstance(profile, Profile)
     assert profile.attributes.name == name
     assert profile.attributes.profileType is profile_type
Esempio n. 7
0
 def test_list_device_ids(self):
     profile_id = ResourceId('M7GU3HQ8CZ')
     devices = self.api_client.profiles.list_device_ids(profile_id)
     assert len(devices) > 0
     for device in devices:
         assert isinstance(device, LinkedResourceData)
         assert device.type is ResourceType.DEVICES
Esempio n. 8
0
 def test_modify_configuration(self):
     capability = self.api_client.bundle_id_capabilities.modify_configuration(
         ResourceId('F88J43FA9J_GAME_CENTER_IOS'),
         CapabilityType.GAME_CENTER,
         None,
     )
     assert isinstance(capability, BundleIdCapability)
     assert capability.type is ResourceType.BUNDLE_ID_CAPABILITIES
 def test_list(self):
     resource_filter = self.api_client.beta_app_review_submissions.Filter(
         build=ResourceId('1525e3c9-3015-407a-9ba5-9addd2558224'), )
     beta_app_review_submissions = self.api_client.beta_app_review_submissions.list(
         resource_filter)
     assert len(beta_app_review_submissions) > 0
     for beta_app_review_submission in beta_app_review_submissions:
         assert isinstance(beta_app_review_submission,
                           BetaAppReviewSubmission)
         assert beta_app_review_submission.type is ResourceType.BETA_APP_REVIEW_SUBMISSIONS
Esempio n. 10
0
 def test_list(self):
     app_store_versions, builds = self.api_client.app_store_versions.list_with_include(
         ResourceId('1453997552'), Build)
     assert len(builds) > 0
     for build in builds:
         assert isinstance(build, Build)
         assert build.type is ResourceType.BUILDS
     assert len(app_store_versions) > 0
     for app_store_version in app_store_versions:
         assert isinstance(app_store_version, AppStoreVersion)
         assert app_store_version.type is ResourceType.APP_STORER_VERSIONS
Esempio n. 11
0
 def test_list(self):
     resource_filter = self.api_client.pre_release_versions.Filter(app=ResourceId('1453997552'))
     pre_release_versions, builds = self.api_client.pre_release_versions.list_with_include(
         Build, resource_filter=resource_filter)
     builds = self.api_client.builds.list()
     assert len(builds) > 0
     for build in builds:
         assert isinstance(build, Build)
         assert build.type is ResourceType.BUILDS
     assert len(pre_release_versions) > 0
     for pre_release_version in pre_release_versions:
         assert isinstance(pre_release_version, PreReleaseVersion)
         assert pre_release_version.type is ResourceType.PRE_RELEASE_VERSIONS
 def test_create(self):
     beta_app_review_submission = self.api_client.beta_app_review_submissions.create(
         build=ResourceId('1525e3c9-3015-407a-9ba5-9addd2558224'), )
     assert isinstance(beta_app_review_submission, BetaAppReviewSubmission)
     assert beta_app_review_submission.type is ResourceType.BETA_APP_REVIEW_SUBMISSIONS
Esempio n. 13
0
 def test_get_bundle_id_resource_id(self):
     profile_id = ResourceId('M7GU3HQ8CZ')
     bundle_id = self.api_client.profiles.get_bundle_id_resource_id(
         profile_id)
     assert isinstance(bundle_id, LinkedResourceData)
     assert bundle_id.type is ResourceType.BUNDLE_ID
Esempio n. 14
0
 def test_read_bundle_id(self):
     profile_id = ResourceId('M7GU3HQ8CZ')
     bundle_id = self.api_client.profiles.read_bundle_id(profile_id)
     assert isinstance(bundle_id, BundleId)
     assert bundle_id.type is ResourceType.BUNDLE_ID
Esempio n. 15
0
 def test_read(self):
     profile_id = ResourceId('M7GU3HQ8CZ')
     profile = self.api_client.profiles.read(profile_id)
     assert isinstance(profile, Profile)
     assert profile.id == profile_id
     assert profile.type is ResourceType.PROFILES
Esempio n. 16
0
 def test_delete(self):
     profile_id = ResourceId('ZK3RZ4B465')
     self.api_client.profiles.delete(profile_id)
 def test_read(self):
     device_id = ResourceId('D9PW3SW6K2')
     device = self.api_client.devices.read(device_id)
     assert isinstance(device, Device)
     assert device.type is ResourceType.DEVICES
import uuid

import pytest

from codemagic.apple.resources import BundleIdPlatform
from codemagic.apple.resources import Device
from codemagic.apple.resources import DeviceStatus
from codemagic.apple.resources import ResourceId
from codemagic.apple.resources import ResourceType
from tests.apple.app_store_connect.resource_manager_test_base import ResourceManagerTestsBase

DEVICE_ID = ResourceId('D9PW3SW6K2')
DEVICE_UDID = '5d0d1e9e3e4c8323756ec0038564006dafe15c21'


@pytest.mark.skip(reason='Live App Store Connect API access')
class DevicesTest(ResourceManagerTestsBase):
    def test_register(self):
        device = self.api_client.devices.create(
            f'test device from {self.__class__.__name__}',
            BundleIdPlatform.IOS, DEVICE_UDID)
        assert isinstance(device, Device)

    def test_list(self):
        devices = self.api_client.devices.list()
        assert len(devices) > 0
        for device in devices:
            assert isinstance(device, Device)
            assert device.type is ResourceType.DEVICES

    def test_read(self):
 def test_disable(self):
     capability_id = ResourceId('F88J43FA9J_ACCESS_WIFI_INFORMATION')
     self.api_client.bundle_id_capabilities.disable(capability_id)
Esempio n. 20
0
import os
import uuid

import pytest

from codemagic.apple.resources import BundleId
from codemagic.apple.resources import BundleIdCapability
from codemagic.apple.resources import BundleIdPlatform
from codemagic.apple.resources import LinkedResourceData
from codemagic.apple.resources import Profile
from codemagic.apple.resources import ResourceId
from codemagic.apple.resources import ResourceType
from tests.apple.app_store_connect.resource_manager_test_base import ResourceManagerTestsBase

CAPYBARA_ID = ResourceId('F88J43FA9J')


@pytest.mark.skipif(not os.environ.get('RUN_LIVE_API_TESTS'),
                    reason='Live App Store Connect API access')
class BundleIdsTest(ResourceManagerTestsBase):
    def test_create(self):
        bundle_id = self.api_client.bundle_ids.create(
            'com.example.test-app',
            'com example test app',
            BundleIdPlatform.IOS,
        )
        assert isinstance(bundle_id, BundleId)

    def test_modify(self):
        new_name = f'io codemagic capybara {uuid.uuid4()}'
        modified_bundle_id = self.api_client.bundle_ids.modify(CAPYBARA_ID,
 def test_revoke(self):
     certificate_id = ResourceId('A7N37QDAWK')
     self.api_client.signing_certificates.delete(certificate_id)
 def test_read(self):
     certificate_id = ResourceId('X6NCZS3K2D')
     certificate = self.api_client.signing_certificates.read(certificate_id)
     assert isinstance(certificate, SigningCertificate)
     assert certificate.id == certificate_id
     assert certificate.type is ResourceType.CERTIFICATES
Esempio n. 23
0
 def test_delete(self):
     self.api_client.bundle_ids.delete(ResourceId('US2AH335HU'))
Esempio n. 24
0
 def test_read_not_found(self):
     with pytest.raises(AppStoreConnectApiError) as exception_info:
         self.api_client.apps.read(ResourceId('invalid-id'))
     response = exception_info.value.response
     assert response.status_code == 404