<s> import unittest <EOL> from google . appengine . api import users <EOL> from google . appengine . ext import testbed <EOL> class LoginTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . testbed = testbed . Testbed ( ) <EOL> self . testbed . activate ( ) <EOL> self . testbed . init_user_stub ( ) <EOL> def tearDown ( self ) : <EOL> self . testbed . deactivate ( ) <EOL> def loginUser ( self , email = '<STR_LIT>' , id = '<STR_LIT>' , is_admin = False ) : <EOL> self . testbed . setup_env ( <EOL> user_email = email , <EOL> user_id = id , <EOL> user_is_admin = '<STR_LIT:1>' if is_admin else '<STR_LIT:0>' , <EOL> overwrite = True ) <EOL> def testLogin ( self ) : <EOL> assert not users . get_current_user ( ) <EOL> self . loginUser ( ) <EOL> assert users . get_current_user ( ) . email ( ) == '<STR_LIT>' <EOL> self . loginUser ( is_admin = True ) <EOL> assert users . is_current_user_admin ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
