Path: blob/develop/tests/functional/s3/test_s3_object_lambda.py
1567 views
#!/usr/bin/env python1# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License"). You4# may not use this file except in compliance with the License. A copy of5# the License is located at6#7# http://aws.amazon.com/apache2.0/8#9# or in the "license" file accompanying this file. This file is10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF11# ANY KIND, either express or implied. See the License for the specific12# language governing permissions and limitations under the License.13from awscli.testutils import BaseAWSCommandParamsTest141516class TestBannerResourcesHandling(BaseAWSCommandParamsTest):1718prefixes = [19's3 ls s3://{banner_arn}',20's3 cp s3://{banner_arn} .',21's3 mv s3://{banner_arn} .',22's3 sync s3://{banner_arn} .',23's3 rm s3://{banner_arn}',24's3 mb s3://{banner_arn}',25's3 presign s3://{banner_arn}',26's3 rb s3://{banner_arn}',27's3 website s3://{banner_arn}',28]2930def test_banner_arn_with_colon_raises_exception(self):31banner_arn = ('arn:aws:s3-object-lambda:us-west-2:123456789012:'32'accesspoint:my-accesspoint')33banner_arn_with_key = '%s/my-key' % banner_arn34for prefix in self.prefixes:35cmdline = prefix.format(banner_arn=banner_arn)36_, stderr, _ = self.run_cmd(cmdline, 255)37self.assertIn('s3 commands do not support', stderr)38cmdline = prefix.format(banner_arn=banner_arn_with_key)39_, stderr, _ = self.run_cmd(cmdline, 255)40self.assertIn('s3 commands do not support', stderr)4142def test_banner_arn_with_slash_raises_exception(self):43banner_arn = ('arn:aws:s3-object-lambda:us-west-2:123456789012:'44'accesspoint/my-accesspoint')45banner_arn_with_key = '%s/my-key' % banner_arn46for prefix in self.prefixes:47cmdline = prefix.format(banner_arn=banner_arn)48_, stderr, _ = self.run_cmd(cmdline, 255)49self.assertIn('s3 commands do not support', stderr)50cmdline = prefix.format(banner_arn=banner_arn_with_key)51_, stderr, _ = self.run_cmd(cmdline, 255)52self.assertIn('s3 commands do not support', stderr)535455