<commit_before>import time

import pytest

from globus_sdk.authorizers.renewing import EXPIRES_ADJUST_SECONDS, RenewingAuthorizer

try:
    import mock
except ImportError:
    from unittest import mock


class MockRenewer(RenewingAuthorizer):
    """
    Class that implements RenewingAuthorizer so that _get_token_response and
    _extract_token_data can return known values for testing
    """

    def __init__(self, token_data, **kwargs):
        self.token_data = token_data
        self.token_response = mock.Mock()
        super(MockRenewer, self).__init__(**kwargs)

    def _get_token_response(self):
        return self.token_response

    def _extract_token_data(self, res):
        return self.token_data


ACCESS_TOKEN = "access_token_1"


@pytest.fixture
def expires_at():
    return int(time.time()) + EXPIRES_ADJUST_SECONDS + 1


@pytest.fixture
def token_data():
    return {
        "expires_at_seconds": int(time.time()) + 1000,
        "access_token": "access_token_2",
    }


@pytest.fixture
def on_refresh():
    return mock.Mock()


@pytest.fixture
def authorizer(on_refresh, token_data, expires_at):
    return MockRenewer(
        token_data,
        access_token=ACCESS_TOKEN,
        expires_at=expires_at,
        on_refresh=on_refresh,
    )


@pytest.fixture
def expired_authorizer(on_refresh, token_data, expires_at):
    return MockRenewer(
        token_data,
        access_token=ACCESS_TOKEN,
        expires_at=expires_at - 1,
        on_refresh=on_refresh,
    )

<commit_msg>Decrease speed requirements for tests<commit_after>import time

import pytest

from globus_sdk.authorizers.renewing import EXPIRES_ADJUST_SECONDS, RenewingAuthorizer

try:
    import mock
except ImportError:
    from unittest import mock


class MockRenewer(RenewingAuthorizer):
    """
    Class that implements RenewingAuthorizer so that _get_token_response and
    _extract_token_data can return known values for testing
    """

    def __init__(self, token_data, **kwargs):
        self.token_data = token_data
        self.token_response = mock.Mock()
        super(MockRenewer, self).__init__(**kwargs)

    def _get_token_response(self):
        return self.token_response

    def _extract_token_data(self, res):
        return self.token_data


ACCESS_TOKEN = "access_token_1"


@pytest.fixture
def expires_at():
    return int(time.time()) + EXPIRES_ADJUST_SECONDS + 10


@pytest.fixture
def token_data():
    return {
        "expires_at_seconds": int(time.time()) + 1000,
        "access_token": "access_<PASSWORD>",
    }


@pytest.fixture
def on_refresh():
    return mock.Mock()


@pytest.fixture
def authorizer(on_refresh, token_data, expires_at):
    return MockRenewer(
        token_data,
        access_token=ACCESS_TOKEN,
        expires_at=expires_at,
        on_refresh=on_refresh,
    )


@pytest.fixture
def expired_authorizer(on_refresh, token_data, expires_at):
    return MockRenewer(
        token_data,
        access_token=ACCESS_TOKEN,
        expires_at=expires_at - 11,
        on_refresh=on_refresh,
    )


{'fraction_non_alphanumeric': 0.08374223094537128, 'fraction_numerical': 0.005561007523716062, 'mean_word_length': 3.4773060029282576, 'pattern_counts': {'":': 4, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5211260', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1009, 'n_words': 204}