def testPutSuccess(self):
    """Tests put() with success."""
    mod_type = 'owner'
    target = 'foouser'
    pkg_name = 'FooPkg-1.2'
    install_types = ['optional_installs', 'managed_updates']
    key_name = '%s##%s' % (target, pkg_name)
    mock_model = self._MockModTypeModel(mod_type)
    user = 'foouser'

    self.MockDoUserAuth(is_admin=True, user=user)
    self.request.get_all('install_types').AndReturn(install_types)
    mock_model(key_name=key_name).AndReturn(mock_model)
    mock_model.put().AndReturn(None)
    self.mox.StubOutWithMock(
        dyn_man.models.BaseManifestModification, 'ResetModMemcache')
    dyn_man.models.BaseManifestModification.ResetModMemcache(
        mod_type, target).AndReturn(None)

    self.mox.ReplayAll()
    self.c.put(mod_type=mod_type, target=target, pkg_name=pkg_name)
    self.assertTrue(mock_model.enabled)
    self.assertEqual(mock_model.target, target)
    self.assertEqual(mock_model.value, pkg_name)
    self.assertEqual(mock_model.manifests, [])
    self.assertEqual(mock_model.user, user)
    self.assertEqual(mock_model.install_types, install_types)
    self.mox.VerifyAll()
dataset/ETHPy150Open google/simian/src/tests/simian/mac/api/dynamic_manifest_test.py/DynamicManifestHandlersTest.testPutSuccess/original