

def run_quarantine_range_etag(self):
    container = ('container-range-%s' % uuid4())
    obj = ('object-range-%s' % uuid4())
    (onode, opart, data_file) = self._setup_data_file(container, obj, 'RANGE')
    metadata = read_metadata(data_file)
    metadata['ETag'] = 'badetag'
    write_metadata(data_file, metadata)
    base_headers = {
        'X-Backend-Storage-Policy-Index': self.policy.idx,
    }
    for (header, result) in [({
        'Range': 'bytes=0-2',
    }, 'RAN'), ({
        'Range': 'bytes=1-11',
    }, 'ANGE'), ({
        'Range': 'bytes=0-11',
    }, 'RANGE')]:
        req_headers = base_headers.copy()
        req_headers.update(result)
        odata = direct_client.direct_get_object(onode, opart, self.account, container, obj, headers=req_headers)[(- 1)]
        self.assertEqual(odata, result)
    try:
        direct_client.direct_get_object(onode, opart, self.account, container, obj, 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_range_etag/VarMisuse@147/237 `header`->`result`