Exemple #1
0
    def test_config_bad_boolean(self):
        self.parser['type'] = {'underline': 'g'}
        with open(self.path, 'w') as fh:
            self.parser.write(fh)

        config = CLIConfig()
        with self.assertRaisesRegex(configparser.Error,
                                    'g.*valid boolean.*valid booleans'):
            config.parse_file(self.path)
Exemple #2
0
    def test_config_bad_color(self):
        self.parser['type'] = {'fg': 'purple'}
        with open(self.path, 'w') as fh:
            self.parser.write(fh)

        config = CLIConfig()
        with self.assertRaisesRegex(configparser.Error,
                                    'purple.*valid color.*valid colors'):
            config.parse_file(self.path)
Exemple #3
0
    def test_config_bad_selector(self):
        self.parser['tye'] = {'underline': 't'}
        with open(self.path, 'w') as fh:
            self.parser.write(fh)

        config = CLIConfig()
        with self.assertRaisesRegex(configparser.Error,
                                    'tye.*valid selector.*valid selectors'):
            config.parse_file(self.path)
Exemple #4
0
    def test_config_expected(self):
        self.parser['type'] = {'underline': 't'}
        with open(self.path, 'w') as fh:
            self.parser.write(fh)

        config = CLIConfig()
        config.parse_file(self.path)

        self.assertEqual(config.styles['type'], {'underline': True})
Exemple #5
0
    def test_config_bad_styling(self):
        self.parser['type'] = {'underlined': 't'}
        with open(self.path, 'w') as fh:
            self.parser.write(fh)

        config = CLIConfig()
        with self.assertRaisesRegex(
                configparser.Error, 'underlined.*valid styling.*valid '
                'stylings'):
            config.parse_file(self.path)
Exemple #6
0
 def test_no_file(self):
     config = CLIConfig()
     with self.assertRaisesRegex(configparser.Error,
                                 "'Path' is not a valid filepath."):
         config.parse_file('Path')