# Path: mollie/api/error.py
# class APIDeprecationWarning(DeprecationWarning):
#     """
#     Features that are deprecated in the Mollie API.
# 
#     This library cannot control when an API feature will be removed. We can only label it as 'deprecated'
#     using this warning, and hope that library users stop using the feature before the removal.
#     """
# 
#     pass
# 
# class IdentifierError(RequestSetupError):
#     """Errors related to invalid resource identifiers that will be requested from the API."""
# 
#     pass
# 
# class RequestError(Error):
#     """Errors while preparing or performing an API request."""
# 
#     pass
# 
# Path: mollie/api/objects/profile.py
# class Profile(ObjectBase):
#     STATUS_UNVERIFIED = "unverified"
#     STATUS_VERIFIED = "verified"
#     STATUS_BLOCKED = "blocked"
# 
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.profiles import Profiles
# 
#         return Profiles(client)
# 
#     @property
#     def id(self):
#         return self._get_property("id")
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def mode(self):
#         return self._get_property("mode")
# 
#     @property
#     def name(self):
#         return self._get_property("name")
# 
#     @property
#     def website(self):
#         return self._get_property("website")
# 
#     @property
#     def email(self):
#         return self._get_property("email")
# 
#     @property
#     def phone(self):
#         return self._get_property("phone")
# 
#     @property
#     def business_category(self):
#         return self._get_property("businessCategory")
# 
#     @property
#     def category_code(self):
#         warnings.warn(
#             "Using categoryCode is deprecated, see https://docs.mollie.com/reference/v2/profiles-api/get-profile",
#             APIDeprecationWarning,
#         )
#         return self._get_property("categoryCode")
# 
#     @property
#     def status(self):
#         return self._get_property("status")
# 
#     @property
#     def review(self):
#         return self._get_property("review")
# 
#     @property
#     def created_at(self):
#         return self._get_property("createdAt")
# 
#     @property
#     def chargebacks(self):
#         return self.client.profile_chargebacks.on(self).list()
# 
#     @property
#     def methods(self):
#         return self.client.profile_methods.on(self).list()
# 
#     @property
#     def payments(self):
#         return self.client.profile_payments.on(self).list()
# 
#     @property
#     def refunds(self):
#         return self.client.profile_refunds.on(self).list()
# 
#     @property
#     def checkout_preview_url(self):
#         return self._get_link("checkoutPreviewUrl")
# 
#     # additional methods
# 
#     def is_unverified(self):
#         return self._get_property("status") == self.STATUS_UNVERIFIED
# 
#     def is_verified(self):
#         return self._get_property("status") == self.STATUS_VERIFIED
# 
#     def is_blocked(self):
#         return self._get_property("status") == self.STATUS_BLOCKED
# 
# Path: mollie/api/resources/profiles.py
# class Profiles(ResourceBase):
#     RESOURCE_ID_PREFIX = "pfl_"
# 
#     def get_resource_object(self, result):
#         return Profile(result, self.client)
# 
#     def get(self, profile_id, **params):
#         if not profile_id or (not profile_id.startswith(self.RESOURCE_ID_PREFIX) and not profile_id == "me"):
#             raise IdentifierError(
#                 f"Invalid profile ID: '{profile_id}'. A profile ID should start with '{self.RESOURCE_ID_PREFIX}' "
#                 "or it should be 'me'."
#             )
#         return super().get(profile_id, **params)
# 
# Path: tests/utils.py
# def assert_list_object(obj, object_type, count=None):
#     """Assert that a List object is correctly working, and has sane contents."""
#     assert isinstance(obj, ObjectList), f"Object {obj} is not a ObjectList instance."
#     assert isinstance(obj.count, int), "ObjectList count is not an integer."
#     if count is not None:
#         assert obj.count == count, "ObjectList does not contain the expected number of items."
#     else:
#         assert obj.count > 0, "ObjectList has no items."
# 
#     # verify items in list
#     items = []
#     for item in obj:
#         assert isinstance(item, object_type)
#         assert item.id is not None
#         items.append(item.id)
# 
#     assert len(items) == obj.count, "Items in ObjectList don't match list count."
#     assert len(set(items)) == obj.count, "Not all object ids in the ObjectList are unique."


import pytest
from mollie.api.error import APIDeprecationWarning, IdentifierError, RequestError
from mollie.api.objects.profile import Profile
from mollie.api.resources.profiles import Profiles
from .utils import assert_list_object



PROFILE_ID = "pfl_v9hTwCvYqw"


def test_profile_resource_class(oauth_client, response):
    response.get(f"https://api.mollie.com/v2/profiles/{PROFILE_ID}", "profile_single")
    oauth_client.profiles.get(PROFILE_ID)

    assert isinstance(Profile.get_resource_class(oauth_client), Profiles)


def test_profiles_get_raises_identifier_error(oauth_client, response):
    response.get(f"https://api.mollie.com/v2/profiles/{PROFILE_ID}", "profile_single")
    oauth_client.profiles.get(PROFILE_ID)

    with pytest.raises(IdentifierError):

# Path: mollie/api/error.py
# class APIDeprecationWarning(DeprecationWarning):
#     """
#     Features that are deprecated in the Mollie API.
# 
#     This library cannot control when an API feature will be removed. We can only label it as 'deprecated'
#     using this warning, and hope that library users stop using the feature before the removal.
#     """
# 
#     pass
# 
# class IdentifierError(RequestSetupError):
#     """Errors related to invalid resource identifiers that will be requested from the API."""
# 
#     pass
# 
# class RequestError(Error):
#     """Errors while preparing or performing an API request."""
# 
#     pass
# 
# Path: mollie/api/objects/profile.py
# class Profile(ObjectBase):
#     STATUS_UNVERIFIED = "unverified"
#     STATUS_VERIFIED = "verified"
#     STATUS_BLOCKED = "blocked"
# 
#     @classmethod
#     def get_resource_class(cls, client):
#         from ..resources.profiles import Profiles
# 
#         return Profiles(client)
# 
#     @property
#     def id(self):
#         return self._get_property("id")
# 
#     @property
#     def resource(self):
#         return self._get_property("resource")
# 
#     @property
#     def mode(self):
#         return self._get_property("mode")
# 
#     @property
#     def name(self):
#         return self._get_property("name")
# 
#     @property
#     def website(self):
#         return self._get_property("website")
# 
#     @property
#     def email(self):
#         return self._get_property("email")
# 
#     @property
#     def phone(self):
#         return self._get_property("phone")
# 
#     @property
#     def business_category(self):
#         return self._get_property("businessCategory")
# 
#     @property
#     def category_code(self):
#         warnings.warn(
#             "Using categoryCode is deprecated, see https://docs.mollie.com/reference/v2/profiles-api/get-profile",
#             APIDeprecationWarning,
#         )
#         return self._get_property("categoryCode")
# 
#     @property
#     def status(self):
#         return self._get_property("status")
# 
#     @property
#     def review(self):
#         return self._get_property("review")
# 
#     @property
#     def created_at(self):
#         return self._get_property("createdAt")
# 
#     @property
#     def chargebacks(self):
#         return self.client.profile_chargebacks.on(self).list()
# 
#     @property
#     def methods(self):
#         return self.client.profile_methods.on(self).list()
# 
#     @property
#     def payments(self):
#         return self.client.profile_payments.on(self).list()
# 
#     @property
#     def refunds(self):
#         return self.client.profile_refunds.on(self).list()
# 
#     @property
#     def checkout_preview_url(self):
#         return self._get_link("checkoutPreviewUrl")
# 
#     # additional methods
# 
#     def is_unverified(self):
#         return self._get_property("status") == self.STATUS_UNVERIFIED
# 
#     def is_verified(self):
#         return self._get_property("status") == self.STATUS_VERIFIED
# 
#     def is_blocked(self):
#         return self._get_property("status") == self.STATUS_BLOCKED
# 
# Path: mollie/api/resources/profiles.py
# class Profiles(ResourceBase):
#     RESOURCE_ID_PREFIX = "pfl_"
# 
#     def get_resource_object(self, result):
#         return Profile(result, self.client)
# 
#     def get(self, profile_id, **params):
#         if not profile_id or (not profile_id.startswith(self.RESOURCE_ID_PREFIX) and not profile_id == "me"):
#             raise IdentifierError(
#                 f"Invalid profile ID: '{profile_id}'. A profile ID should start with '{self.RESOURCE_ID_PREFIX}' "
#                 "or it should be 'me'."
#             )
#         return super().get(profile_id, **params)
# 
# Path: tests/utils.py
# def assert_list_object(obj, object_type, count=None):
#     """Assert that a List object is correctly working, and has sane contents."""
#     assert isinstance(obj, ObjectList), f"Object {obj} is not a ObjectList instance."
#     assert isinstance(obj.count, int), "ObjectList count is not an integer."
#     if count is not None:
#         assert obj.count == count, "ObjectList does not contain the expected number of items."
#     else:
#         assert obj.count > 0, "ObjectList has no items."
# 
#     # verify items in list
#     items = []
#     for item in obj:
#         assert isinstance(item, object_type)
#         assert item.id is not None
#         items.append(item.id)
# 
#     assert len(items) == obj.count, "Items in ObjectList don't match list count."
#     assert len(set(items)) == obj.count, "Not all object ids in the ObjectList are unique."


# Path: tests/test_profiles.py
import pytest
from mollie.api.error import APIDeprecationWarning, IdentifierError, RequestError
from mollie.api.objects.profile import Profile
from mollie.api.resources.profiles import Profiles
from .utils import assert_list_object




PROFILE_ID = "pfl_v9hTwCvYqw"


def test_profile_resource_class(oauth_client, response):
    response.get(f"https://api.mollie.com/v2/profiles/{PROFILE_ID}", "profile_single")
    oauth_client.profiles.get(PROFILE_ID)

    assert isinstance(Profile.get_resource_class(oauth_client), Profiles)


def test_profiles_get_raises_identifier_error(oauth_client, response):
    response.get(f"https://api.mollie.com/v2/profiles/{PROFILE_ID}", "profile_single")
    oauth_client.profiles.get(PROFILE_ID)

    with pytest.raises(IdentifierError):

        Profiles(oauth_client).get(None)