def test_cleans_previous_token_before_fetching_new_one(self):
        """Makes sure the previous token is cleaned before fetching a new one.

        The reason behind it is that, if the previous token is expired, this
        method shouldn't fail with a TokenExpiredError, since it's attempting
        to get a new one (which shouldn't be expired).

        """
        new_token = deepcopy(self.token)
        past = time.time() - 7200
        now = time.time()
        self.token['expires_at'] = past
        new_token['expires_at'] = now + 3600
        url = 'https://example.com/token'

        with mock.patch('time.time', lambda: now):
            for client in self.clients:
                auth = OAuth2Session(client=client, token=self.token)
                auth.send = fake_token(new_token)
                self.assertEqual(auth.fetch_token(url), new_token)
dataset/ETHPy150Open requests/requests-oauthlib/tests/test_oauth2_session.py/OAuth2SessionTest.test_cleans_previous_token_before_fetching_new_one/original