# Path: firebase_admin/credentials.py
# class Base:
# class Certificate(Base):
# class ApplicationDefault(Base):
# class RefreshToken(Base):
#     def get_access_token(self):
#     def get_credential(self):
#     def __init__(self, cert):
#     def project_id(self):
#     def signer(self):
#     def service_account_email(self):
#     def get_credential(self):
#     def __init__(self):
#     def get_credential(self):
#     def project_id(self):
#     def _load_credential(self):
#     def __init__(self, refresh_token):
#     def client_id(self):
#     def client_secret(self):
#     def refresh_token(self):
#     def get_credential(self):
# def _is_file_path(path):
#     _CREDENTIAL_TYPE = 'service_account'
#     _CREDENTIAL_TYPE = 'authorized_user'
# 
# Path: firebase_admin/_utils.py
# _ERROR_CODE_TO_EXCEPTION_TYPE = {
#     exceptions.INVALID_ARGUMENT: exceptions.InvalidArgumentError,
#     exceptions.FAILED_PRECONDITION: exceptions.FailedPreconditionError,
#     exceptions.OUT_OF_RANGE: exceptions.OutOfRangeError,
#     exceptions.UNAUTHENTICATED: exceptions.UnauthenticatedError,
#     exceptions.PERMISSION_DENIED: exceptions.PermissionDeniedError,
#     exceptions.NOT_FOUND: exceptions.NotFoundError,
#     exceptions.ABORTED: exceptions.AbortedError,
#     exceptions.ALREADY_EXISTS: exceptions.AlreadyExistsError,
#     exceptions.CONFLICT: exceptions.ConflictError,
#     exceptions.RESOURCE_EXHAUSTED: exceptions.ResourceExhaustedError,
#     exceptions.CANCELLED: exceptions.CancelledError,
#     exceptions.DATA_LOSS: exceptions.DataLossError,
#     exceptions.UNKNOWN: exceptions.UnknownError,
#     exceptions.INTERNAL: exceptions.InternalError,
#     exceptions.UNAVAILABLE: exceptions.UnavailableError,
#     exceptions.DEADLINE_EXCEEDED: exceptions.DeadlineExceededError,
# }
# _HTTP_STATUS_TO_ERROR_CODE = {
#     400: exceptions.INVALID_ARGUMENT,
#     401: exceptions.UNAUTHENTICATED,
#     403: exceptions.PERMISSION_DENIED,
#     404: exceptions.NOT_FOUND,
#     409: exceptions.CONFLICT,
#     412: exceptions.FAILED_PRECONDITION,
#     429: exceptions.RESOURCE_EXHAUSTED,
#     500: exceptions.INTERNAL,
#     503: exceptions.UNAVAILABLE,
# }
# _RPC_CODE_TO_ERROR_CODE = {
#     1: exceptions.CANCELLED,
#     2: exceptions.UNKNOWN,
#     3: exceptions.INVALID_ARGUMENT,
#     4: exceptions.DEADLINE_EXCEEDED,
#     5: exceptions.NOT_FOUND,
#     6: exceptions.ALREADY_EXISTS,
#     7: exceptions.PERMISSION_DENIED,
#     8: exceptions.RESOURCE_EXHAUSTED,
#     9: exceptions.FAILED_PRECONDITION,
#     10: exceptions.ABORTED,
#     11: exceptions.OUT_OF_RANGE,
#     13: exceptions.INTERNAL,
#     14: exceptions.UNAVAILABLE,
#     15: exceptions.DATA_LOSS,
#     16: exceptions.UNAUTHENTICATED,
# }
# def _get_initialized_app(app):
# def get_app_service(app, name, initializer):
# def handle_platform_error_from_requests(error, handle_func=None):
# def handle_operation_error(error):
# def _handle_func_requests(error, message, error_dict):
# def handle_requests_error(error, message=None, code=None):
# def _http_status_to_error_code(status):
# def _rpc_code_to_error_code(rpc_code):
# def _error_code_to_exception_type(code):
# def _parse_platform_error(content, status_code):
#     def __init__(self):
#     def refresh(self, request):
# class EmulatorAdminCredentials(google.auth.credentials.Credentials):
# 
# Path: tests/testutils.py
# def resource_filename(filename):
# def resource(filename):
# def cleanup_apps():
# def run_without_project_id(func):
# def new_monkeypatch():
#     def __init__(self, status, response):
#     def status(self):
#     def headers(self):
#     def data(self):
#     def __init__(self, status, response):
#     def __call__(self, *args, **kwargs): # pylint: disable=arguments-differ
#     def __init__(self, error):
#     def __call__(self, *args, **kwargs): # pylint: disable=arguments-differ
#     def refresh(self, request):
#     def __init__(self):
#     def get_credential(self):
#     def __init__(self, responses, statuses, recorder):
#     def send(self, request, **kwargs): # pylint: disable=arguments-differ
#     def __init__(self, data, status, recorder):
#     def status(self):
#     def data(self):
# class MockResponse(transport.Response):
# class MockRequest(transport.Request):
# class MockFailedRequest(transport.Request):
# class MockGoogleCredential(credentials.Credentials):
# class MockCredential(firebase_admin.credentials.Base):
# class MockMultiRequestAdapter(adapters.HTTPAdapter):
# class MockAdapter(MockMultiRequestAdapter):


from collections import namedtuple
from firebase_admin import credentials
from firebase_admin import _utils
from tests import testutils
import os
import pytest
import firebase_admin

# This fixture will ignore the environment variable pointing to the default
# configuration for the duration of the tests.

class CredentialProvider:
    def init(self):
        pass

    def get(self):
        pass

    def cleanup(self):
        pass


class Cert(CredentialProvider):
    def get(self):
        return CREDENTIAL


class RefreshToken(CredentialProvider):
    def get(self):
        return credentials.RefreshToken(testutils.resource_filename('refresh_token.json'))


class ExplicitAppDefault(CredentialProvider):
    VAR_NAME = 'GOOGLE_APPLICATION_CREDENTIALS'

    def init(self):
        self.file_path = os.environ.get(self.VAR_NAME)

# Path: firebase_admin/credentials.py
# class Base:
# class Certificate(Base):
# class ApplicationDefault(Base):
# class RefreshToken(Base):
#     def get_access_token(self):
#     def get_credential(self):
#     def __init__(self, cert):
#     def project_id(self):
#     def signer(self):
#     def service_account_email(self):
#     def get_credential(self):
#     def __init__(self):
#     def get_credential(self):
#     def project_id(self):
#     def _load_credential(self):
#     def __init__(self, refresh_token):
#     def client_id(self):
#     def client_secret(self):
#     def refresh_token(self):
#     def get_credential(self):
# def _is_file_path(path):
#     _CREDENTIAL_TYPE = 'service_account'
#     _CREDENTIAL_TYPE = 'authorized_user'
# 
# Path: firebase_admin/_utils.py
# _ERROR_CODE_TO_EXCEPTION_TYPE = {
#     exceptions.INVALID_ARGUMENT: exceptions.InvalidArgumentError,
#     exceptions.FAILED_PRECONDITION: exceptions.FailedPreconditionError,
#     exceptions.OUT_OF_RANGE: exceptions.OutOfRangeError,
#     exceptions.UNAUTHENTICATED: exceptions.UnauthenticatedError,
#     exceptions.PERMISSION_DENIED: exceptions.PermissionDeniedError,
#     exceptions.NOT_FOUND: exceptions.NotFoundError,
#     exceptions.ABORTED: exceptions.AbortedError,
#     exceptions.ALREADY_EXISTS: exceptions.AlreadyExistsError,
#     exceptions.CONFLICT: exceptions.ConflictError,
#     exceptions.RESOURCE_EXHAUSTED: exceptions.ResourceExhaustedError,
#     exceptions.CANCELLED: exceptions.CancelledError,
#     exceptions.DATA_LOSS: exceptions.DataLossError,
#     exceptions.UNKNOWN: exceptions.UnknownError,
#     exceptions.INTERNAL: exceptions.InternalError,
#     exceptions.UNAVAILABLE: exceptions.UnavailableError,
#     exceptions.DEADLINE_EXCEEDED: exceptions.DeadlineExceededError,
# }
# _HTTP_STATUS_TO_ERROR_CODE = {
#     400: exceptions.INVALID_ARGUMENT,
#     401: exceptions.UNAUTHENTICATED,
#     403: exceptions.PERMISSION_DENIED,
#     404: exceptions.NOT_FOUND,
#     409: exceptions.CONFLICT,
#     412: exceptions.FAILED_PRECONDITION,
#     429: exceptions.RESOURCE_EXHAUSTED,
#     500: exceptions.INTERNAL,
#     503: exceptions.UNAVAILABLE,
# }
# _RPC_CODE_TO_ERROR_CODE = {
#     1: exceptions.CANCELLED,
#     2: exceptions.UNKNOWN,
#     3: exceptions.INVALID_ARGUMENT,
#     4: exceptions.DEADLINE_EXCEEDED,
#     5: exceptions.NOT_FOUND,
#     6: exceptions.ALREADY_EXISTS,
#     7: exceptions.PERMISSION_DENIED,
#     8: exceptions.RESOURCE_EXHAUSTED,
#     9: exceptions.FAILED_PRECONDITION,
#     10: exceptions.ABORTED,
#     11: exceptions.OUT_OF_RANGE,
#     13: exceptions.INTERNAL,
#     14: exceptions.UNAVAILABLE,
#     15: exceptions.DATA_LOSS,
#     16: exceptions.UNAUTHENTICATED,
# }
# def _get_initialized_app(app):
# def get_app_service(app, name, initializer):
# def handle_platform_error_from_requests(error, handle_func=None):
# def handle_operation_error(error):
# def _handle_func_requests(error, message, error_dict):
# def handle_requests_error(error, message=None, code=None):
# def _http_status_to_error_code(status):
# def _rpc_code_to_error_code(rpc_code):
# def _error_code_to_exception_type(code):
# def _parse_platform_error(content, status_code):
#     def __init__(self):
#     def refresh(self, request):
# class EmulatorAdminCredentials(google.auth.credentials.Credentials):
# 
# Path: tests/testutils.py
# def resource_filename(filename):
# def resource(filename):
# def cleanup_apps():
# def run_without_project_id(func):
# def new_monkeypatch():
#     def __init__(self, status, response):
#     def status(self):
#     def headers(self):
#     def data(self):
#     def __init__(self, status, response):
#     def __call__(self, *args, **kwargs): # pylint: disable=arguments-differ
#     def __init__(self, error):
#     def __call__(self, *args, **kwargs): # pylint: disable=arguments-differ
#     def refresh(self, request):
#     def __init__(self):
#     def get_credential(self):
#     def __init__(self, responses, statuses, recorder):
#     def send(self, request, **kwargs): # pylint: disable=arguments-differ
#     def __init__(self, data, status, recorder):
#     def status(self):
#     def data(self):
# class MockResponse(transport.Response):
# class MockRequest(transport.Request):
# class MockFailedRequest(transport.Request):
# class MockGoogleCredential(credentials.Credentials):
# class MockCredential(firebase_admin.credentials.Base):
# class MockMultiRequestAdapter(adapters.HTTPAdapter):
# class MockAdapter(MockMultiRequestAdapter):


# Path: tests/test_app.py
from collections import namedtuple
from firebase_admin import credentials
from firebase_admin import _utils
from tests import testutils
import os
import pytest
import firebase_admin


# This fixture will ignore the environment variable pointing to the default
# configuration for the duration of the tests.

class CredentialProvider:
    def init(self):
        pass

    def get(self):
        pass

    def cleanup(self):
        pass


class Cert(CredentialProvider):
    def get(self):
        return CREDENTIAL


class RefreshToken(CredentialProvider):
    def get(self):
        return credentials.RefreshToken(testutils.resource_filename('refresh_token.json'))


class ExplicitAppDefault(CredentialProvider):
    VAR_NAME = 'GOOGLE_APPLICATION_CREDENTIALS'

    def init(self):
        self.file_path = os.environ.get(self.VAR_NAME)

        os.environ[self.VAR_NAME] = testutils.resource_filename('service_account.json')