#NEWLINE# def testDoOAuthAuthSuccess( self ) : #NEWLINE# #INDENT# 'Test DoOAuthAuth() with success, where user is in KeyValueCache.' #NEWLINE# self . mox . StubOutWithMock ( auth . oauth , 'get_current_user' ) #NEWLINE# self . mox . StubOutWithMock ( auth , 'IsAdminUser' ) #NEWLINE# self . mox . StubOutWithMock ( auth . models . KeyValueCache , 'MemcacheWrappedGet' ) #NEWLINE# self . mox . StubOutWithMock ( auth . util , 'Deserialize' ) #NEWLINE# mock_user = self . mox . CreateMockAnything ( ) #NEWLINE# email = 'foouser@example.com' #NEWLINE# auth . settings . OAUTH_USERS = [ ] #NEWLINE# oauth_users = [ email ] #NEWLINE# auth . oauth . get_current_user ( ) . AndReturn ( mock_user ) #NEWLINE# mock_user . email ( ) . AndReturn ( email ) #NEWLINE# auth . IsAdminUser ( email ) . AndReturn ( True ) #NEWLINE# auth . models . KeyValueCache . MemcacheWrappedGet ( 'oauth_users' , 'text_value' ) . AndReturn ( oauth_users ) #NEWLINE# auth . util . Deserialize ( oauth_users ) . AndReturn ( oauth_users ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# auth . DoOAuthAuth ( is_admin = True ) #NEWLINE# self . mox . VerifyAll ( )