

def run_quarantine_zero_byte_head(self):
    container = ('container-zbyte-%s' % uuid4())
    obj = ('object-zbyte-%s' % uuid4())
    (onode, opart, data_file) = self._setup_data_file(container, obj, 'DATA')
    metadata = read_metadata(data_file)
    unlink(data_file)
    with open(data_file, 'w') as fpointer:
        write_metadata(fpointer, metadata)
    try:
        direct_client.direct_head_object(onode, opart, self.account, container, obj, conn_timeout=1, response_timeout=1, headers={
            'X-Backend-Storage-Policy-Index': self.policy.idx,
        })
        raise Exception('Did not quarantine object')
    except ClientException as err:
        self.assertEqual(err.http_status, 404)

dataset/ETHPy150Open openstack/swift/test/probe/test_object_failures.py TestObjectFailures.run_quarantine_zero_byte_head/original