示例#1
0
    def test_read_no_validation(self, fake_config):
        paths = ['path_A', 'path_B']

        # test
        cfg = read_config(paths=paths, validate=False)

        # validation
        fake_config.assert_called_with(*paths)
        self.assertFalse(fake_config().validate.called)
        self.assertEqual(cfg, fake_config())
示例#2
0
    def test_read_paths(self, fake_config):
        paths = ['path_A', 'path_B']

        # test
        cfg = read_config(paths=paths)

        # validation
        fake_config.assert_called_with(*paths)
        fake_config().validate.assert_called_with(SCHEMA)
        self.assertEqual(cfg, fake_config())
示例#3
0
    def test_read(self, fake_config, fake_expanduser, fake_listdir):
        fake_listdir.return_value = ['A', 'B', 'C']
        fake_expanduser.return_value = '/home/pulp/.pulp/admin.conf'

        # test
        cfg = read_config()

        # validation
        paths = [
            '/etc/pulp/admin/admin.conf',
            '/etc/pulp/admin/conf.d/A',
            '/etc/pulp/admin/conf.d/B',
            '/etc/pulp/admin/conf.d/C',
        ]

        fake_config.assert_called_with(*paths)
        fake_config().validate.assert_called_with(SCHEMA)
        self.assertEqual(cfg, fake_config())
示例#4
0
def main():
    exit_code = launcher.main(read_config(), exception_handler_class=AdminExceptionHandler)
    sys.exit(exit_code)
示例#5
0
    def test_read_calls_validate_overrides(self, mock_validate_overrides, fake_config):
        read_config()

        mock_validate_overrides.assert_called_once()
示例#6
0
    def test_read_calls_validate_overrides(self, mock_validate_overrides,
                                           fake_config):
        read_config()

        mock_validate_overrides.assert_called_once()
示例#7
0
def main():
    exit_code = launcher.main(read_config(),
                              exception_handler_class=AdminExceptionHandler)
    sys.exit(exit_code)