#NEWLINE# def testBaseModelMemcacheWrappedGetWhenCached( self ) : #NEWLINE# #INDENT# 'Test BaseModel.MemcacheWrappedGet() when cached.' #NEWLINE# key_name = 'foo_key_name' #NEWLINE# memcache_key_name = ( 'mwg_%s_%s' % ( models . BaseModel . kind ( ) , mock_entity ) ) #NEWLINE# self . mox . StubOutWithMock ( models , 'memcache' , True ) #NEWLINE# self . mox . StubOutWithMock ( models . BaseModel , 'get_by_key_name' , True ) #NEWLINE# self . mox . StubOutWithMock ( models . db , 'model_from_protobuf' , True ) #NEWLINE# mock_entity = self . mox . CreateMockAnything ( ) #NEWLINE# models . memcache . get ( memcache_key_name ) . AndReturn ( 'serialized' ) #NEWLINE# models . db . model_from_protobuf ( 'serialized' ) . AndReturn ( mock_entity ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# self . assertEqual ( mock_entity , models . BaseModel . MemcacheWrappedGet ( key_name ) ) #NEWLINE# self . mox . VerifyAll ( )