Esempio n. 1
0
 def test_get_config_file_list(self, mock_config_path):
     paths = mock.Mock()
     paths.default_config.return_value = 'a'
     paths.account_config.return_value = ['b', 'c']
     mock_config_path.return_value = paths
     assert Config.get_config_file_list() == ['a', 'b', 'c']
     paths.default_config.assert_called_once_with()
     paths.account_config.assert_called_once_with()
Esempio n. 2
0
    def __list(self):
        config_files = Config.get_config_file_list()
        default_config_file = config_files[0] or '<missing>'
        if os.path.islink(default_config_file):
            default_config_file = os.readlink(default_config_file)

        self.result.add(
            'default_config_file', default_config_file
        )

        for config_file in config_files:
            if config_file and not os.path.islink(config_file):
                setup = AccountSetup(config_file)
                account_info = setup.list()
                if account_info:
                    self.result.add(config_file, account_info)

        self.out.display()