def testMemcacheWrappedSet(self):
    self.mox.StubOutWithMock(models, 'memcache', True)
    self.mox.StubOutWithMock(models.BaseModel, 'kind')
    self.mox.StubOutWithMock(models.BaseModel, 'get_or_insert')
    self.mox.StubOutWithMock(models.db, 'model_to_protobuf', True)
    mock_entity = self.mox.CreateMockAnything()

    memcache_entity_key = 'mwg_kind_key'
    memcache_key = 'mwgpn_kind_key_prop'
    models.BaseModel.kind().AndReturn('kind')
    models.BaseModel.kind().AndReturn('kind')
    models.BaseModel.get_or_insert('key').AndReturn(mock_entity)
    mock_entity.put()
    models.db.model_to_protobuf(mock_entity).AndReturn(mock_entity)  # cheat
    mock_entity.SerializeToString().AndReturn('serialized')
    models.memcache.set(
        memcache_key, 'value', models.MEMCACHE_SECS).AndReturn(None)
    models.memcache.set(
        memcache_entity_key, 'serialized',
        models.MEMCACHE_SECS).AndReturn(None)

    self.mox.ReplayAll()
    models.BaseModel.MemcacheWrappedSet('key', 'prop', 'value')
    self.mox.VerifyAll()
Test BaseModel.MemcacheWrappedSet().
dataset/ETHPy150Open google/simian/src/tests/simian/mac/models/base_test.py/ModelsModuleTest.testMemcacheWrappedSet