Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)])
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
def _TypeFlag():
    return flags.StringFlag(
        '--type',
        help=
        'Type of Component to create. See `kuberun devkits describe` for available Component Types.',
        required=True)
Exemplo n.º 6
0
def _DevKitFlag():
    return flags.StringFlag(
        '--devkit',
        help='Name of the Development Kit to use for this Component.',
        required=True)
Exemplo n.º 7
0
def _OutFlag():
    return flags.StringFlag(
        '--out',
        help='Output directory for rendered resource yaml.',
        required=True)
Exemplo n.º 8
0
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)