def testPostWithMissingArgs(self):
    self.mox.StubOutWithMock(uploadpkg.handlers, 'IsBlobstore')
    msg = 'uploadpkg POST required parameters missing'

    # missing user
    uploadpkg.handlers.IsBlobstore().AndReturn(True)
    self.MockDoMunkiAuth(require_level=uploadpkg.gaeserver.LEVEL_UPLOADPKG)
    self.request.get('user').AndReturn('')
    self.request.get('name').AndReturn('anything')
    self.request.get('install_types').AndReturn('anything')
    self.request.get('catalogs', None).AndReturn('anything')
    self.request.get('manifests', None).AndReturn(None)
    self.MockRedirect('/uploadpkg?mode=error&msg=%s' % msg)
    # missing name
    uploadpkg.handlers.IsBlobstore().AndReturn(True)
    self.MockDoMunkiAuth(require_level=uploadpkg.gaeserver.LEVEL_UPLOADPKG)
    self.request.get('user').AndReturn('anything')
    self.request.get('name').AndReturn('')
    self.request.get('install_types').AndReturn('anything')
    self.request.get('catalogs', None).AndReturn('anything')
    self.request.get('manifests', None).AndReturn(None)
    self.MockRedirect('/uploadpkg?mode=error&msg=%s' % msg)
    # missing install_types
    uploadpkg.handlers.IsBlobstore().AndReturn(True)
    self.MockDoMunkiAuth(require_level=uploadpkg.gaeserver.LEVEL_UPLOADPKG)
    self.request.get('user').AndReturn('anything')
    self.request.get('name').AndReturn('anything')
    self.request.get('install_types').AndReturn('')
    self.request.get('catalogs', None).AndReturn('anything')
    self.request.get('manifests', None).AndReturn(None)
    self.MockRedirect('/uploadpkg?mode=error&msg=%s' % msg)
    # missing catalogs
    uploadpkg.handlers.IsBlobstore().AndReturn(True)
    self.MockDoMunkiAuth(require_level=uploadpkg.gaeserver.LEVEL_UPLOADPKG)
    self.request.get('user').AndReturn('anything')
    self.request.get('name').AndReturn('anything')
    self.request.get('install_types').AndReturn('anything')
    self.request.get('catalogs', None).AndReturn(None)
    self.request.get('manifests', None).AndReturn(None)
    self.MockRedirect('/uploadpkg?mode=error&msg=%s' % msg)

    self.mox.ReplayAll()
    self.c.post()
    self.c.post()
    self.c.post()
    self.c.post()
    self.mox.VerifyAll()
Test updating a package with missing name/track/etc.
dataset/ETHPy150Open google/simian/src/tests/simian/mac/munki/handlers/uploadpkg_test.py/UploadPackageTest.testPostWithMissingArgs