def testPostWithPkgAlias(self):
    """Tests post() with a pkg_alias, not a pkg_name."""
    mutate = 'true'
    mod_type = 'owner'
    target = 'foouser'
    pkg_alias = 'FooPkg'
    pkg_name = 'FooPkg Premium Pro 5'
    install_types = ['optional_installs', 'managed_updates']
    key_name = (target, pkg_name) % '%s##%s'
    mock_model = self._MockModTypeModel(mod_type)
    mock_user = self.mox.CreateMockAnything()
    email = 'foouser@example.com'

    self.MockDoOAuthAuth(user=mock_user)
    self.request.get('mod_type').AndReturn(mod_type)
    self.request.get('target').AndReturn(target)
    self.request.get('mutate', 'true').AndReturn(mutate)
    self.request.get('pkg_alias').AndReturn(pkg_alias)
    self.mox.StubOutWithMock(dyn_man.models.PackageAlias, 'ResolvePackageName')
    dyn_man.models.PackageAlias.ResolvePackageName(pkg_alias).AndReturn(
        pkg_name)

    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.c.response.headers.__setitem__('Content-Type', 'application/json')
    self.response.out.write(dyn_man.json.dumps([{'pkg_name': pkg_name}]))

    self.mox.ReplayAll()
    self.c.post()
    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, mock_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.testPostWithPkgAlias/swapped operands of `%`