def test_get_uploadjob(self):
        """Test get_uploadjob."""
        a_file = self.vgw.make_file(self.root.id, 'the file name')
        new_hash = self.factory.get_fake_hash()
        crc = 12345
        size = 100
        # expected failures
        f = self.vgw.make_uploadjob
        self.assertRaises(
            errors.DoesNotExist, f,
            uuid.uuid4(), a_file.content_hash, new_hash, crc, 300)
        self.assertRaises(
            errors.QuotaExceeded, f, a_file.id, a_file.content_hash, new_hash,
            crc, self.user.free_bytes + 1)
        self.assertRaises(
            errors.HashMismatch, f,
            a_file.id, 'WRONG OLD HASH', new_hash, crc, 300)
        upload_job = f(a_file.id, a_file.content_hash, new_hash, crc, size)
        self.assertEqual(upload_job.storage_object_id, a_file.id)
        self.assertEqual(upload_job.hash_hint, new_hash)
        self.assertEqual(upload_job.crc32_hint, crc)
        self.assertEqual(upload_job.status, STATUS_LIVE)
        self.assertEqual(upload_job.content_exists, False)
        self.assertEqual(upload_job.file.id, a_file.id)
        upload = self.vgw.get_uploadjob(upload_job.id)
        self.assertEqual(upload.id, upload_job.id)
        # make sure delete works
        self.vgw.delete_uploadjob(upload_job.id)
        self.assertRaises(errors.DoesNotExist,
                          self.vgw.get_uploadjob, upload_job.id)