Skip to content

Commit

Permalink
aws#4832 Add --include --exclude to aws s3 ls test case
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong committed Feb 11, 2020
1 parent 3f0165f commit 7c92aed
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tests/unit/customizations/s3/test_subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_ls_command_for_bucket(self):
ls_command = ListCommand(self.session)
parsed_args = FakeArgs(paths='s3://mybucket/', dir_op=False,
page_size='5', human_readable=False,
summarize=False, request_payer=None)
summarize=False, request_payer=None, filters=[['--include', '*']])
parsed_globals = mock.Mock()
ls_command._run_main(parsed_args, parsed_globals)
call = self.session.create_client.return_value.list_objects_v2
Expand All @@ -118,7 +118,7 @@ def test_ls_command_with_no_args(self):
verify_ssl=None)
parsed_args = FakeArgs(dir_op=False, paths='s3://',
human_readable=False, summarize=False,
request_payer=None)
request_payer=None, filters=[['--include', '*']])
ls_command._run_main(parsed_args, parsed_global)
# We should only be a single call.
call = self.session.create_client.return_value.list_buckets
Expand All @@ -139,7 +139,7 @@ def test_ls_with_verify_argument(self):
verify_ssl=False)
parsed_args = FakeArgs(paths='s3://', dir_op=False,
human_readable=False, summarize=False,
request_payer=None)
request_payer=None, filters=[['--include', '*']])
ls_command._run_main(parsed_args, parsed_global)
# Verify get_client
get_client = self.session.create_client
Expand All @@ -152,7 +152,7 @@ def test_ls_with_requester_pays(self):
ls_command = ListCommand(self.session)
parsed_args = FakeArgs(paths='s3://mybucket/', dir_op=False,
human_readable=False, summarize=False,
request_payer='requester', page_size='5')
request_payer='requester', page_size='5', filters=[['--include', '*']])
parsed_globals = mock.Mock()
ls_command._run_main(parsed_args, parsed_globals)
call = self.session.create_client.return_value.list_objects
Expand All @@ -171,6 +171,19 @@ def test_ls_with_requester_pays(self):

paginate.assert_called_with(**ref_call_args)

def test_ls_with_filters(self):
ls_command = ListCommand(self.session)
parsed_global = FakeArgs(region='us-west-2', endpoint_url=None,
verify_ssl=False)
parsed_args = FakeArgs(paths='s3://', dir_op=False,
human_readable=False, summarize=False,
request_payer=None, filters=[['--include', '*']])
ls_command._run_main(parsed_args, parsed_global)
get_client = self.session.create_client
args = get_client.call_args
self.assertEqual(args, mock.call(
's3', region_name='us-west-2', endpoint_url=None, verify=False,
config=None))

class CommandArchitectureTest(BaseAWSCommandParamsTest):
def setUp(self):
Expand Down

0 comments on commit 7c92aed

Please sign in to comment.