Don't assume again and expand test.

* When introducing the "Don't assume!" changes I also assumed that there were always more than one argument from the shell. Expanded the testcase to include this check.
This commit is contained in:
Pedro Algarvio 2012-11-09 11:32:36 +00:00
parent 75f70e49f3
commit 527cf4ee38
2 changed files with 6 additions and 1 deletions

View file

@ -730,7 +730,7 @@ class SaltCMDOptionParser(OptionParser, ConfigDirMixIn, TimeoutMixIn,
# Include the target
if self.args[0] != '*':
self.args.insert(0, '*')
if self.args[1] != 'sys.doc':
if len(self.args) < 2 or self.args[1] != 'sys.doc':
# Include the function
self.args.insert(1, 'sys.doc')

View file

@ -154,10 +154,15 @@ class MatchTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
'''
Test to see if we're not auto-adding '*' and 'sys.doc' to the call
'''
data = self.run_salt('\'*\' -d')
self.assertIn('user.add:', data)
data = self.run_salt('\'*\' -d user.add')
self.assertIn('user.add:', data)
data = self.run_salt('\'*\' sys.doc -d user.add')
self.assertIn('user.add:', data)
data = self.run_salt('\'*\' sys.doc user.add')
self.assertIn('user.add:', data)
if __name__ == "__main__":