# 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: 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):


import platform
import pytest
import firebase_admin
from firebase_admin import credentials
    from firebase_admin import firestore
from tests import testutils
    reason='Firestore is not supported on PyPy')
class TestFirestore:
    """Test class Firestore APIs."""

    def teardown_method(self, method):
        del method
        testutils.cleanup_apps()

    def test_no_project_id(self):
        def evaluate():
            firebase_admin.initialize_app(testutils.MockCredential())
            with pytest.raises(ValueError):
                firestore.client()
        testutils.run_without_project_id(evaluate)

    def test_project_id(self):
        cred = credentials.Certificate(testutils.resource_filename('service_account.json'))
        firebase_admin.initialize_app(cred, {'projectId': 'explicit-project-id'})
        client = firestore.client()
        assert client is not None
        assert client.project == 'explicit-project-id'

    def test_project_id_with_explicit_app(self):
        cred = credentials.Certificate(testutils.resource_filename('service_account.json'))
        app = firebase_admin.initialize_app(cred, {'projectId': 'explicit-project-id'})
        client = firestore.client(app=app)
        assert client is not None
        assert client.project == 'explicit-project-id'

    def test_service_account(self):

# 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: 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_firestore.py
import platform
import pytest
import firebase_admin
from firebase_admin import credentials
    from firebase_admin import firestore
from tests import testutils

    reason='Firestore is not supported on PyPy')
class TestFirestore:
    """Test class Firestore APIs."""

    def teardown_method(self, method):
        del method
        testutils.cleanup_apps()

    def test_no_project_id(self):
        def evaluate():
            firebase_admin.initialize_app(testutils.MockCredential())
            with pytest.raises(ValueError):
                firestore.client()
        testutils.run_without_project_id(evaluate)

    def test_project_id(self):
        cred = credentials.Certificate(testutils.resource_filename('service_account.json'))
        firebase_admin.initialize_app(cred, {'projectId': 'explicit-project-id'})
        client = firestore.client()
        assert client is not None
        assert client.project == 'explicit-project-id'

    def test_project_id_with_explicit_app(self):
        cred = credentials.Certificate(testutils.resource_filename('service_account.json'))
        app = firebase_admin.initialize_app(cred, {'projectId': 'explicit-project-id'})
        client = firestore.client(app=app)
        assert client is not None
        assert client.project == 'explicit-project-id'

    def test_service_account(self):

        cred = credentials.Certificate(testutils.resource_filename('service_account.json'))