def test_precondition_failed_error(self):
    bucket = ('bucket-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket)
    client.put_object(Bucket=bucket, Key='foo', Body=b'{"foo": "bar"}')
    try:
        client.get_object(Bucket=bucket, Key='foo', IfMatch='"not good etag"')
    except ClientError as e:
        self.assertEqual(e.response['Error']['Code'], 'PreconditionFailed')
        self.assertEqual(e.response['Error']['Message'], 'At least one of the pre-conditions you specified did not hold')
    client.delete_object(Bucket=bucket, Key='foo')
    client.delete_bucket(Bucket=bucket)
def test_precondition_failed_error(self):
    bucket = ('bucket-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket)
    client.put_object(Bucket=bucket, Key='foo', Body=b'{"foo": "bar"}')
    try:
        client.get_object(Bucket=bucket, Key='foo', IfMatch='"not good etag"')
    except ClientError as e:
        self.assertEqual(e.response['Error']['Code'], 'PreconditionFailed')
        self.assertEqual(e.response['Error']['Message'], 'At least one of the pre-conditions you specified did not hold')
    client.delete_object(Bucket=bucket, Key='foo')
    client.delete_bucket(Bucket=bucket)