#NEWLINE# def testBaseModelMemcacheWrappedGet( self ) : #NEWLINE# #INDENT# 'Test BaseModel.MemcacheWrappedGet() when not cached.' #NEWLINE# key_name = 'foo_key_name' #NEWLINE# memcache_key_name = ( 'mwg_%s_%s' % ( models . BaseModel . kind ( ) , key_name ) ) #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_to_protobuf' , True ) #NEWLINE# mock_entity = self . mox . CreateMockAnything ( ) #NEWLINE# models . db . model_to_protobuf ( mock_entity ) . AndReturn ( key_name ) #NEWLINE# mock_entity . SerializeToString ( ) . AndReturn ( 'serialized' ) #NEWLINE# models . memcache . get ( memcache_key_name ) . AndReturn ( None ) #NEWLINE# models . BaseModel . get_by_key_name ( key_name ) . AndReturn ( mock_entity ) #NEWLINE# models . memcache . set ( memcache_key_name , 'serialized' , models . MEMCACHE_SECS ) . AndReturn ( None ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# self . assertEqual ( mock_entity , models . BaseModel . MemcacheWrappedGet ( key_name ) ) #NEWLINE# self . mox . VerifyAll ( )