<s> import unittest <EOL> import sys <EOL> import os <EOL> import time <EOL> from pydrive . auth import GoogleAuth <EOL> class GoogleAuthTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_01_LocalWebserverAuthWithClientConfigFromFile ( self ) : <EOL> self . DeleteOldCredentialsFile ( '<STR_LIT>' ) <EOL> ga = GoogleAuth ( '<STR_LIT>' ) <EOL> ga . LocalWebserverAuth ( ) <EOL> self . assertEqual ( ga . access_token_expired , False ) <EOL> self . CheckCredentialsFile ( '<STR_LIT>' ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> def test_02_LocalWebserverAuthWithClientConfigFromSettings ( self ) : <EOL> self . DeleteOldCredentialsFile ( '<STR_LIT>' ) <EOL> ga = GoogleAuth ( '<STR_LIT>' ) <EOL> ga . LocalWebserverAuth ( ) <EOL> self . assertEqual ( ga . access_token_expired , False ) <EOL> self . CheckCredentialsFile ( '<STR_LIT>' ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> def test_03_LocalWebServerAuthWithNoCredentialsSaving ( self ) : <EOL> self . DeleteOldCredentialsFile ( '<STR_LIT>' ) <EOL> ga = GoogleAuth ( '<STR_LIT>' ) <EOL> ga . LocalWebserverAuth ( ) <EOL> self . assertEqual ( ga . access_token_expired , False ) <EOL> self . CheckCredentialsFile ( '<STR_LIT>' , no_file = True ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> def test_04_CommandLineAuthWithClientConfigFromFile ( self ) : <EOL> self . DeleteOldCredentialsFile ( '<STR_LIT>' ) <EOL> ga = GoogleAuth ( '<STR_LIT>' ) <EOL> ga . CommandLineAuth ( ) <EOL> self . assertEqual ( ga . access_token_expired , False ) <EOL> self . CheckCredentialsFile ( '<STR_LIT>' ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> def test_05_ConfigFromSettingsWithoutOauthScope ( self ) : <EOL> ga = GoogleAuth ( '<STR_LIT>' ) <EOL> ga . LocalWebserverAuth ( ) <EOL> self . assertEqual ( ga . access_token_expired , False ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> def DeleteOldCredentialsFile ( self , credentials ) : <EOL> try : <EOL> os . remove ( credentials ) <EOL> except OSError : <EOL> pass <EOL> def CheckCredentialsFile ( self , credentials , no_file = False ) : <EOL> ga = GoogleAuth ( '<STR_LIT>' ) <EOL> ga . LoadCredentialsFile ( credentials ) <EOL> self . assertEqual ( ga . access_token_expired , no_file ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
