Esempio n. 1
0
    def test_parse___Just_username_with_minus_minus_password_and_host___Return_appropriate_settings(self):

        expected = Settings('hostname', password='******')
        parser = CommandLineSettingsParser()
        result = parser.parse_args(['--password', 'aramathea', 'hostname'])

        self.assertEquals(expected, result)
Esempio n. 2
0
    def test_parse___Just_username_with_minus_minus_username_and_host___Return_appropriate_settings(self):

        expected = Settings('hostname', username='******')
        parser = CommandLineSettingsParser()
        result = parser.parse_args(['--username', 'sir robin', 'hostname'])

        self.assertEquals(expected, result)
Esempio n. 3
0
    def test_parse___Just_host___Return_appropriate_settings(self):

        expected = Settings('hostname')
        parser = CommandLineSettingsParser()
        result = parser.parse_args(['hostname'])

        self.assertEquals(expected, result)
Esempio n. 4
0
    def test_parse___Empty_list___Return_None(self):

        expected = None
        parser = CommandLineSettingsParser()
        result = parser.parse_args([])

        self.assertEquals(expected, result)
Esempio n. 5
0
    def _parse_options(self):

        parser = CommandLineSettingsParser()
        settings = parser.parse_args(sys.argv[1:])

        if settings is None:
            parser.print_help()
            sys.exit(1)

        return settings
Esempio n. 6
0
    def _parse_options(self):

        parser = CommandLineSettingsParser()
        settings = parser.parse_args(sys.argv[1:])

        if settings is None:
            parser.print_help()
            sys.exit(1)

        return settings