def testStringFlag_FormatFlags_missing(self): self.args.IsSpecified.return_value = False string_flag = flags.StringFlag('--test-flag') actual = string_flag.FormatFlags(self.args) self.assertListEqual([], actual)
def testStringFlag_AddToParser(self): flag_name = '--test-flag' help_text = 'some help text' string_flag = flags.StringFlag(flag_name, help=help_text) string_flag.AddToParser(self.parser) self.parser.assert_has_calls( [mock.call.add_argument(flag_name, help=help_text)])
def testStringFlag_FormatFlags_coerceToString(self): integer_value = 10 self.args.test_flag = integer_value self.args.IsSpecified.return_value = True string_flag = flags.StringFlag('--test-flag') actual = string_flag.FormatFlags(self.args) self.args.IsSpecified.assert_called_with('test_flag') self.assertListEqual(['--test-flag', str(integer_value)], actual)
def testStringFlag_FormatFlags_present(self): expected_value = 'expected_test_value' self.args.test_flag = expected_value self.args.IsSpecified.return_value = True string_flag = flags.StringFlag('--test-flag') actual = string_flag.FormatFlags(self.args) self.args.IsSpecified.assert_called_with('test_flag') self.assertListEqual(['--test-flag', expected_value], actual)
def _TypeFlag(): return flags.StringFlag( '--type', help= 'Type of Component to create. See `kuberun devkits describe` for available Component Types.', required=True)
def _DevKitFlag(): return flags.StringFlag( '--devkit', help='Name of the Development Kit to use for this Component.', required=True)
def _OutFlag(): return flags.StringFlag( '--out', help='Output directory for rendered resource yaml.', required=True)
def _DirectoryFlag(): return flags.StringFlag( '--directory', help='Base directory path relative to current working directory where Component will be created. This path must be within the application git repository.', required=False)