Esempio n. 1
0
    def test_construct_command(self):
        """_construct_command builds a command using flags and arguments"""
        Base.command_base = 'basecommand'
        Base.command_sub = 'subcommand'
        command_parts = Base._construct_command(
            {'flag-one': True, 'flag-two': False, 'argument': 'value', 'ommited-arg': None}
        ).split()

        assert 'basecommand' in command_parts
        assert 'subcommand' in command_parts
        assert '--flag-one' in command_parts
        assert '--argument="value"' in command_parts
        assert '--flag-two' not in command_parts
        assert len(command_parts) == 4
Esempio n. 2
0
    def test_construct_command(self):
        """_construct_command builds a command using flags and arguments"""
        Base.command_base = 'basecommand'
        Base.command_sub = 'subcommand'
        command_parts = Base._construct_command({
            u'flag-one': True,
            u'flag-two': False,
            u'argument': u'value',
            u'ommited-arg': None,
        }).split()

        self.assertIn(u'basecommand', command_parts)
        self.assertIn(u'subcommand', command_parts)
        self.assertIn(u'--flag-one', command_parts)
        self.assertIn(u'--argument="value"', command_parts)
        self.assertNotIn(u'--flag-two', command_parts)
        self.assertEqual(len(command_parts), 4)