# Path: awslimitchecker/tests/services/result_fixtures.py
# def get_boto3_resource_model(service_name, resource_name):
#     def test_instance_usage(self):
#     def test_instance_usage_vcpu(self):
#     def test_instance_usage_key_error(self):
#     def test_find_usage_networking_sgs(self):
#     def test_find_usage_networking_eips(self):
#     def test_find_usage_networking_eni_sg(self):
# class EBS(object):
# class VPC(object):
# class RDS(object):
# class ElasticBeanstalk(object):
# class CloudFront(object):
# class ELB(object):
# class Lambda(object):
# class ElastiCache(object):
# class EC2(object):
# class IAM(object):
# class Firehose(object):
# class Redshift(object):
# class ApiGateway(object):
# class DynamoDB(object):
# class Route53(object):
# class CloudTrail(object):
# class Kinesis(object):
# class EKS(object):
# class CertificateManager(object):
# 
# Path: awslimitchecker/services/certificatemanager.py
# class _CertificatemanagerService(_AwsService):
# 
#     service_name = 'CertificateManager'
#     api_name = 'acm'  # AWS API name to connect to (boto3.client)
#     quotas_service_code = 'acm'
# 
#     def find_usage(self):
#         """
#         List CloudFront distributions by calling AWS list_certificates, and
#         update usage in self.limits for the limit 'ACM certificates'
#         """
#         logger.debug("Checking usage for service %s", self.service_name)
#         self.connect()
#         for lim in self.limits.values():
#             lim._reset_usage()
# 
#         self._find_usage_certificates()
# 
#         self._have_usage = True
#         logger.debug("Done checking usage.")
# 
#     def _find_usage_certificates(self):
#         """find usage for ACM certificates"""
#         res = paginate_dict(
#             self.conn.list_certificates,
#             alc_marker_path=['NextToken'],
#             alc_data_path=['CertificateSummaryList'],
#             alc_marker_param='NextToken'
#         )
#         if 'CertificateSummaryList' not in res:
#             nb_certificates = 0
#         else:
#             nb_certificates = len(res['CertificateSummaryList'])
#         self.limits['ACM certificates']._add_current_usage(nb_certificates)
# 
#     def get_limits(self):
#         """
#         Return all known limits for this service, as a dict of their names
#         to :py:class:`~.AwsLimit` objects.
# 
#         :returns: dict of limit names to :py:class:`~.AwsLimit` objects
#         :rtype: dict
#         """
#         if self.limits != {}:
#             return self.limits
#         limits = {}
#         limits['ACM certificates'] = AwsLimit(
#             'ACM certificates',
#             self,
#             1000,
#             self.warning_threshold,
#             self.critical_threshold
#         )
#         self.limits = limits
#         return limits
# 
#     def required_iam_permissions(self):
#         """
#         Return a list of IAM Actions required for this Service to function
#         properly. All Actions will be shown with an Effect of "Allow"
#         and a Resource of "*".
# 
#         :returns: list of IAM Action strings
#         :rtype: list
#         """
#         return [
#             "acm:ListCertificates",
#         ]


import sys
from awslimitchecker.tests.services import result_fixtures
from awslimitchecker.services.certificatemanager import \
    _CertificatemanagerService
    from mock import patch, call, Mock, DEFAULT
    from unittest.mock import patch, call, Mock, DEFAULT

    def test_find_usage(self):
        """
        Test overall find_usage method
        Check that find_usage() method calls the other methods.
        """
        with patch.multiple(
            pb,
            connect=DEFAULT,
            _find_usage_certificates=DEFAULT,
            autospec=True
        ) as mocks:
            cls = _CertificatemanagerService(21, 43, {}, None)
            assert cls._have_usage is False
            cls.find_usage()

        assert cls._have_usage is True
        assert len(mocks) == 2
        # the other methods should have been called
        for x in [
            "_find_usage_certificates"
        ]:
            assert mocks[x].mock_calls == [call(cls)]

    def test_find_usage_certificates_empty(self):
        """
        Verify the correctness of usage (when there are no certificates)
        This test mocks the AWS list_certificates response (after pagination).
        """
        # Setup the mock and call the tested function

# Path: awslimitchecker/tests/services/result_fixtures.py
# def get_boto3_resource_model(service_name, resource_name):
#     def test_instance_usage(self):
#     def test_instance_usage_vcpu(self):
#     def test_instance_usage_key_error(self):
#     def test_find_usage_networking_sgs(self):
#     def test_find_usage_networking_eips(self):
#     def test_find_usage_networking_eni_sg(self):
# class EBS(object):
# class VPC(object):
# class RDS(object):
# class ElasticBeanstalk(object):
# class CloudFront(object):
# class ELB(object):
# class Lambda(object):
# class ElastiCache(object):
# class EC2(object):
# class IAM(object):
# class Firehose(object):
# class Redshift(object):
# class ApiGateway(object):
# class DynamoDB(object):
# class Route53(object):
# class CloudTrail(object):
# class Kinesis(object):
# class EKS(object):
# class CertificateManager(object):
# 
# Path: awslimitchecker/services/certificatemanager.py
# class _CertificatemanagerService(_AwsService):
# 
#     service_name = 'CertificateManager'
#     api_name = 'acm'  # AWS API name to connect to (boto3.client)
#     quotas_service_code = 'acm'
# 
#     def find_usage(self):
#         """
#         List CloudFront distributions by calling AWS list_certificates, and
#         update usage in self.limits for the limit 'ACM certificates'
#         """
#         logger.debug("Checking usage for service %s", self.service_name)
#         self.connect()
#         for lim in self.limits.values():
#             lim._reset_usage()
# 
#         self._find_usage_certificates()
# 
#         self._have_usage = True
#         logger.debug("Done checking usage.")
# 
#     def _find_usage_certificates(self):
#         """find usage for ACM certificates"""
#         res = paginate_dict(
#             self.conn.list_certificates,
#             alc_marker_path=['NextToken'],
#             alc_data_path=['CertificateSummaryList'],
#             alc_marker_param='NextToken'
#         )
#         if 'CertificateSummaryList' not in res:
#             nb_certificates = 0
#         else:
#             nb_certificates = len(res['CertificateSummaryList'])
#         self.limits['ACM certificates']._add_current_usage(nb_certificates)
# 
#     def get_limits(self):
#         """
#         Return all known limits for this service, as a dict of their names
#         to :py:class:`~.AwsLimit` objects.
# 
#         :returns: dict of limit names to :py:class:`~.AwsLimit` objects
#         :rtype: dict
#         """
#         if self.limits != {}:
#             return self.limits
#         limits = {}
#         limits['ACM certificates'] = AwsLimit(
#             'ACM certificates',
#             self,
#             1000,
#             self.warning_threshold,
#             self.critical_threshold
#         )
#         self.limits = limits
#         return limits
# 
#     def required_iam_permissions(self):
#         """
#         Return a list of IAM Actions required for this Service to function
#         properly. All Actions will be shown with an Effect of "Allow"
#         and a Resource of "*".
# 
#         :returns: list of IAM Action strings
#         :rtype: list
#         """
#         return [
#             "acm:ListCertificates",
#         ]


# Path: awslimitchecker/tests/services/test_certificatemanager.py
import sys
from awslimitchecker.tests.services import result_fixtures
from awslimitchecker.services.certificatemanager import \
    _CertificatemanagerService
    from mock import patch, call, Mock, DEFAULT
    from unittest.mock import patch, call, Mock, DEFAULT


    def test_find_usage(self):
        """
        Test overall find_usage method
        Check that find_usage() method calls the other methods.
        """
        with patch.multiple(
            pb,
            connect=DEFAULT,
            _find_usage_certificates=DEFAULT,
            autospec=True
        ) as mocks:
            cls = _CertificatemanagerService(21, 43, {}, None)
            assert cls._have_usage is False
            cls.find_usage()

        assert cls._have_usage is True
        assert len(mocks) == 2
        # the other methods should have been called
        for x in [
            "_find_usage_certificates"
        ]:
            assert mocks[x].mock_calls == [call(cls)]

    def test_find_usage_certificates_empty(self):
        """
        Verify the correctness of usage (when there are no certificates)
        This test mocks the AWS list_certificates response (after pagination).
        """
        # Setup the mock and call the tested function

        resp = result_fixtures.CertificateManager\