Example #1
0
 def test_access_token_refreshes_timeout_longer(self, mock_refresh):
     mock_refresh.return_value = {
         'access_token': 'abc',
         'refresh_token': '123',
         'expires_at': time.time(),
     }
     user_settings = GoogleDriveUserSettingsFactory()
     user_settings.expires_at = datetime.utcnow() + relativedelta.relativedelta(minutes=4)
     user_settings.access_token
     mock_refresh.assert_called_once()
Example #2
0
 def test_access_token_refreshes(self, mock_needs_refresh, mock_refresh):
     mock_refresh.return_value = {
         'access_token': 'abc',
         'refresh_token': '123',
         'expires_at': time.time(),
     }
     user_settings = GoogleDriveUserSettingsFactory()
     user_settings.expires_at = datetime.now()
     user_settings.access_token
     mock_refresh.assert_called_once()