From 1e7510fdc131d3f3680dc22280522246c93e22d0 Mon Sep 17 00:00:00 2001 From: kyleknap Date: Wed, 30 Nov 2016 10:13:06 -0800 Subject: [PATCH] Add a more complex alias test Ensure you can provide an function in an external alias and execute with arguments provided to it --- tests/functional/test_alias.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/functional/test_alias.py b/tests/functional/test_alias.py index baee2c05fd58..be3d47bdbcc0 100644 --- a/tests/functional/test_alias.py +++ b/tests/functional/test_alias.py @@ -13,6 +13,7 @@ import os from awscli.alias import AliasLoader +from awscli.testutils import skip_if_windows from awscli.testutils import FileCreator from awscli.testutils import BaseAWSCommandParamsTest @@ -209,3 +210,12 @@ def test_external_alias_then_additonal_args(self): self.add_alias('mkdir', '!mkdir') self.run_cmd('mkdir %s' % directory_to_make) self.assertTrue(os.path.isdir(directory_to_make)) + + @skip_if_windows('Windows does not support BASH functions') + def test_external_alias_with_wrapper_bash_function(self): + # The external alias is tested by using mkdir; a command that + # is universal for the various OS's we support + directory_to_make = os.path.join(self.files.rootdir, 'newdir') + self.add_alias('mkdir', '!f() { mkdir "${1}"; }; f') + self.run_cmd('mkdir %s' % directory_to_make) + self.assertTrue(os.path.isdir(directory_to_make))