def testBaseModelMemcacheWrappedGet(self):
    key_name = 'foo_key_name'
    memcache_key_name = 'mwg_%s_%s' % (models.BaseModel.kind(), key_name)

    self.mox.StubOutWithMock(models, 'memcache', True)
    self.mox.StubOutWithMock(models.BaseModel, 'get_by_key_name', True)
    self.mox.StubOutWithMock(models.db, 'model_to_protobuf', True)
    mock_entity = self.mox.CreateMockAnything()

    models.db.model_to_protobuf(mock_entity).AndReturn(mock_entity)  # cheat
    mock_entity.SerializeToString().AndReturn('serialized')
    models.memcache.get(memcache_key_name).AndReturn(None)
    models.BaseModel.get_by_key_name(key_name).AndReturn(mock_entity)
    models.memcache.set(
        memcache_key_name, 'serialized', models.MEMCACHE_SECS).AndReturn(None)

    self.mox.ReplayAll()
    self.assertEqual(
        mock_entity, models.BaseModel.MemcacheWrappedGet(key_name))
    self.mox.VerifyAll()
copy(target_file, destination)
dataset/ETHPy150Open google/simian/src/tests/simian/mac/models/base_test.py/ModelsModuleTest.testBaseModelMemcacheWrappedGet--crossover with--dataset/ETHPy150Open facebook/IT-CPE/code/lib/modules/fs_tools.py/copy