Пример #1
0
class ConfigTest(unittest.TestCase):

    def test_config_off(self):
        try:
            os.remove(build_config_file_path('test-awsshellrc'))
        except OSError:
            pass
        self.aws_shell = AWSShell(None, mock.Mock(), mock.Mock())
        self.aws_shell.model_completer.match_fuzzy = False
        self.aws_shell.enable_vi_bindings = False
        self.aws_shell.show_completion_columns = False
        self.aws_shell.show_help = False
        self.aws_shell.theme = 'none'
        self.aws_shell.save_config()
        self.aws_shell.load_config()
        assert self.aws_shell.model_completer.match_fuzzy == False
        assert self.aws_shell.enable_vi_bindings == False
        assert self.aws_shell.show_completion_columns == False
        assert self.aws_shell.show_help == False
        assert self.aws_shell.theme == 'none'

    def test_config_on(self):
        self.aws_shell = AWSShell(None, mock.Mock(), mock.Mock())
        self.aws_shell.model_completer.match_fuzzy = True
        self.aws_shell.enable_vi_bindings = True
        self.aws_shell.show_completion_columns = True
        self.aws_shell.show_help = True
        self.aws_shell.theme = 'vim'
        self.aws_shell.save_config()
        self.aws_shell.load_config()
        assert self.aws_shell.config_section.as_bool('match_fuzzy') == True
        assert self.aws_shell.config_section.as_bool(
            'enable_vi_bindings') == True
        assert self.aws_shell.config_section.as_bool(
            'show_completion_columns') == True
        assert self.aws_shell.config_section.as_bool('show_help') == True
        assert self.aws_shell.config_section['theme'] == 'vim'
Пример #2
0
class ConfigTest(unittest.TestCase):
    def test_config_off(self):
        try:
            os.remove(build_config_file_path('test-awsshellrc'))
        except OSError:
            pass
        self.aws_shell = AWSShell(None, mock.Mock(), mock.Mock())
        self.aws_shell.model_completer.match_fuzzy = False
        self.aws_shell.enable_vi_bindings = False
        self.aws_shell.show_completion_columns = False
        self.aws_shell.show_help = False
        self.aws_shell.theme = 'none'
        self.aws_shell.save_config()
        self.aws_shell.load_config()
        assert self.aws_shell.model_completer.match_fuzzy == False
        assert self.aws_shell.enable_vi_bindings == False
        assert self.aws_shell.show_completion_columns == False
        assert self.aws_shell.show_help == False
        assert self.aws_shell.theme == 'none'

    def test_config_on(self):
        self.aws_shell = AWSShell(None, mock.Mock(), mock.Mock())
        self.aws_shell.model_completer.match_fuzzy = True
        self.aws_shell.enable_vi_bindings = True
        self.aws_shell.show_completion_columns = True
        self.aws_shell.show_help = True
        self.aws_shell.theme = 'vim'
        self.aws_shell.save_config()
        self.aws_shell.load_config()
        assert self.aws_shell.config_section.as_bool('match_fuzzy') == True
        assert self.aws_shell.config_section.as_bool(
            'enable_vi_bindings') == True
        assert self.aws_shell.config_section.as_bool(
            'show_completion_columns') == True
        assert self.aws_shell.config_section.as_bool('show_help') == True
        assert self.aws_shell.config_section['theme'] == 'vim'