# Path: tokenserver/verifiers.py
# DEFAULT_OAUTH_SCOPE = 'https://identity.mozilla.com/apps/oldsync'
# def get_browserid_verifier(registry=None):
# def get_oauth_verifier(registry=None):
#     def __init__(self, trusted_issuers=None, allowed_issuers=None, **kwargs):
#     def _emit_warning():
#     def verify(self, assertion, audience=None):
#     def __init__(self, audiences=None, trusted_issuers=None,
#                  allowed_issuers=None, verifier_url=None, timeout=None):
#     def verify(self, assertion, audience=None):
#     def __init__(self, server_url=None, default_issuer=None, timeout=30,
#                  scope=DEFAULT_OAUTH_SCOPE, jwks=None):
#     def server_url(self):
#     def timeout(self):
#     def verify(self, token):
# class IBrowserIdVerifier(Interface):
# class IOAuthVerifier(Interface):
# class LocalBrowserIdVerifier(browserid.verifiers.local.LocalVerifier):
# class RemoteBrowserIdVerifier(object):
# class RemoteOAuthVerifier(object):


import socket
import unittest
import responses
import contextlib
import fxa.errors
from pyramid.config import Configurator
from tokenserver.verifiers import (
    IOAuthVerifier,
    ConnectionError,
    RemoteOAuthVerifier,
)
            "mozsvc.secrets.FixedSecrets",
        "tokenserver.secrets.secrets":
            "steve-let-the-dogs-out",
    }

    def _make_config(self, settings={}):
        all_settings = self.DEFAULT_SETTINGS.copy()
        all_settings.update(settings)
        config = Configurator(settings=all_settings)
        config.include("tokenserver")
        config.commit()
        return config

    @contextlib.contextmanager
    def _mock_verifier(self, verifier, response=None, exc=None):
        def replacement_verify_token_method(*args, **kwds):
            if exc is not None:
                raise exc
            if response is not None:
                return response
            raise RuntimeError("incomplete mock")
        orig_verify_token_method = verifier._client.verify_token
        verifier._client.verify_token = replacement_verify_token_method
        try:
            yield None
        finally:
            verifier._client.verify_token = orig_verify_token_method

    def test_verifier_config_loading_defaults(self):
        config = self._make_config()

# Path: tokenserver/verifiers.py
# DEFAULT_OAUTH_SCOPE = 'https://identity.mozilla.com/apps/oldsync'
# def get_browserid_verifier(registry=None):
# def get_oauth_verifier(registry=None):
#     def __init__(self, trusted_issuers=None, allowed_issuers=None, **kwargs):
#     def _emit_warning():
#     def verify(self, assertion, audience=None):
#     def __init__(self, audiences=None, trusted_issuers=None,
#                  allowed_issuers=None, verifier_url=None, timeout=None):
#     def verify(self, assertion, audience=None):
#     def __init__(self, server_url=None, default_issuer=None, timeout=30,
#                  scope=DEFAULT_OAUTH_SCOPE, jwks=None):
#     def server_url(self):
#     def timeout(self):
#     def verify(self, token):
# class IBrowserIdVerifier(Interface):
# class IOAuthVerifier(Interface):
# class LocalBrowserIdVerifier(browserid.verifiers.local.LocalVerifier):
# class RemoteBrowserIdVerifier(object):
# class RemoteOAuthVerifier(object):


# Path: tokenserver/tests/test_oauth_verifier.py
import socket
import unittest
import responses
import contextlib
import fxa.errors
from pyramid.config import Configurator
from tokenserver.verifiers import (
    IOAuthVerifier,
    ConnectionError,
    RemoteOAuthVerifier,
)

            "mozsvc.secrets.FixedSecrets",
        "tokenserver.secrets.secrets":
            "steve-let-the-dogs-out",
    }

    def _make_config(self, settings={}):
        all_settings = self.DEFAULT_SETTINGS.copy()
        all_settings.update(settings)
        config = Configurator(settings=all_settings)
        config.include("tokenserver")
        config.commit()
        return config

    @contextlib.contextmanager
    def _mock_verifier(self, verifier, response=None, exc=None):
        def replacement_verify_token_method(*args, **kwds):
            if exc is not None:
                raise exc
            if response is not None:
                return response
            raise RuntimeError("incomplete mock")
        orig_verify_token_method = verifier._client.verify_token
        verifier._client.verify_token = replacement_verify_token_method
        try:
            yield None
        finally:
            verifier._client.verify_token = orig_verify_token_method

    def test_verifier_config_loading_defaults(self):
        config = self._make_config()

        verifier = config.registry.getUtility(IOAuthVerifier)