Example #1
0
 def testFindCompletionsPositionalFallback(self):
     cmd_line = 'gcloud sdk xyzzy '
     with self.assertRaises(lookup.CannotHandleCompletionError):
         lookup._FindCompletions(self.root, cmd_line)
Example #2
0
 def testFindCompletionsGroupFlagAfterCommand(self):
     cmd_line = 'gcloud beta sdk betagroup beta-command --loc'
     self.assertEqual(['--location='],
                      lookup._FindCompletions(self.root, cmd_line))
Example #3
0
 def testFindCompletionsCommandAfterFlagValueCompletion(self):
     cmd_line = 'gcloud sdk --verbosity=error xy'
     self.assertEqual(['xyzzy'],
                      lookup._FindCompletions(self.root, cmd_line))
Example #4
0
 def testFindCompletionsFlagValueGeneric(self):
     cmd_line = 'gcloud sdk xyzzy --exactly-one='
     self.assertEqual([], lookup._FindCompletions(self.root, cmd_line))
Example #5
0
 def testFindCompletionsFlagValueDynamicFallback(self):
     cmd_line = 'gcloud beta sdk betagroup sub-command-a --resourceful=on'
     with self.assertRaises(lookup.CannotHandleCompletionError):
         lookup._FindCompletions(self.root, cmd_line)
Example #6
0
 def testFindCompletionsFlagValueCompletion(self):
     cmd_line = 'gcloud sdk --verbosity=e'
     self.assertEqual(['error'],
                      lookup._FindCompletions(self.root, cmd_line))
Example #7
0
 def testFindCompletionsFlagValueCompletionWithEquals(self):
     cmd_line = 'gcloud sdk --verbosity '
     self.assertEqual(
         ['critical', 'debug', 'error', 'info', 'none', 'warning'],
         lookup._FindCompletions(self.root, cmd_line))
Example #8
0
 def testFindCompletionsGlobalFlagCompletion(self):
     cmd_line = 'gcloud sdk --lo'
     self.assertEqual(['--log-http'],
                      lookup._FindCompletions(self.root, cmd_line))
Example #9
0
 def testFindCompletionsAfterFlagCompletion(self):
     cmd_line = 'gcloud sdk --log-http xy'
     self.assertEqual(['xyzzy'],
                      lookup._FindCompletions(self.root, cmd_line))
Example #10
0
 def testFindCompletionsIncorrectFlagCompletion(self):
     cmd_line = 'gcloud sdk xyzzy --exte'
     self.assertEqual([], lookup._FindCompletions(self.root, cmd_line))
Example #11
0
 def testFindCompletionsPartialFlagCompletion(self):
     cmd_line = 'gcloud sdk xyzzy --ex'
     self.assertEqual(['--exactly-one=', '--exactly-three='],
                      lookup._FindCompletions(self.root, cmd_line))
Example #12
0
 def testFindCompletionsIncorrectCompletions(self):
     cmd_line = 'gcloud blpha int'
     self.assertEqual([], lookup._FindCompletions(self.root, cmd_line))
Example #13
0
 def testFindCompletionsMultipleCommandCompletion(self):
     cmd_line = 'gcloud '
     self.assertEqual(['alpha', 'beta', 'internal', 'sdk', 'version'],
                      lookup._FindCompletions(self.root, cmd_line))
Example #14
0
 def testFindCompletionsPartialCommandCompletion(self):
     cmd_line = 'gcloud alpha int'
     self.assertEqual(['internal'],
                      lookup._FindCompletions(self.root, cmd_line))