def _testUpload(self):
        """
        Upload a file to the server and several partial files.  Test that we
        can delete a partial upload but not a completed upload. Test that we
        can delete partial uploads that are older than a certain date.
        """
        completeUpload = self._uploadFile('complete_upload')
        # test uploading large files
        self._uploadFile('complete_upload', largeFile=True)
        partialUploads = []
        for largeFile in (False, True):
            for partial in range(3):
                partialUploads.append(self._uploadFile(
                    'partial_upload_%d_%s' % (partial, str(largeFile)),
                    partial, largeFile))
        # check that a user cannot list partial uploads
        resp = self.request(path='/system/uploads', method='GET',
                            user=self.user)
        self.assertStatus(resp, 403)
        # The admin user should see all of the partial uploads, but not the
        # complete upload
        resp = self.request(path='/system/uploads', method='GET',
                            user=self.admin)
        self.assertStatusOk(resp)
        foundUploads = resp.json
        self.assertEqual(len(foundUploads), len(partialUploads))
        # The user shouldn't be able to delete an upload
        resp = self.request(path='/system/uploads', method='DELETE',
                            user=self.user,
                            params={'uploadId': partialUploads[0]['_id']})
        self.assertStatus(resp, 403)
        # We shouldn't be able to delete the completed upload
        resp = self.request(path='/system/uploads', method='DELETE',
                            user=self.admin,
                            params={'uploadId': completeUpload['_id']})
        self.assertStatusOk(resp)
        self.assertEqual(resp.json, [])
        resp = self.request(path='/system/uploads', method='GET',
                            user=self.admin)
        self.assertEqual(len(resp.json), len(partialUploads))
        # The admin should be able to ask for a partial upload by id
        resp = self.request(path='/system/uploads', method='GET',
                            user=self.admin,
                            params={'uploadId': partialUploads[0]['_id']})
        self.assertStatusOk(resp)
        self.assertEqual(resp.json[0]['_id'], partialUploads[0]['_id'])
        # The admin should be able to ask for a partial upload by assetstore id
        resp = self.request(path='/system/uploads', method='GET',
                            user=self.admin,
                            params={'assetstoreId': self.assetstore['_id']})
        self.assertStatusOk(resp)
        self.assertEqual(len(resp.json), len(partialUploads))
        # The admin should be able to ask for a partial upload by age.
        # Everything should be more than 0 days old
        resp = self.request(path='/system/uploads', method='GET',
                            user=self.admin,
                            params={'minimumAge': 0})
        self.assertStatusOk(resp)
        self.assertEqual(len(resp.json), len(partialUploads))
        # The admin should be able to delete an upload
        resp = self.request(path='/system/uploads', method='DELETE',
                            user=self.admin,
                            params={'uploadId': partialUploads[0]['_id']})
        self.assertStatusOk(resp)
        self.assertEqual(resp.json[0]['_id'], partialUploads[0]['_id'])
        # We should now have one less partial upload
        resp = self.request(path='/system/uploads', method='GET',
                            user=self.admin)
        self.assertEqual(len(resp.json), len(partialUploads)-1)
        # If we ask to delete everything more than one day old, nothing should
        # be deleted.
        resp = self.request(path='/system/uploads', method='DELETE',
                            user=self.admin,
                            params={'minimumAge': 1})
        self.assertStatusOk(resp)
        self.assertEqual(resp.json, [])
        # Delete all partial uploads
        resp = self.request(path='/system/uploads', method='DELETE',
                            user=self.admin)
        self.assertStatusOk(resp)
        resp = self.request(path='/system/uploads', method='GET',
                            user=self.admin)
        self.assertEqual(resp.json, [])
dataset/ETHPy150Open girder/girder/tests/cases/upload_test.py/UploadTestCase._testUpload/original