# -*- coding: utf-8 -*-

import unittest

from .utils import all_available_methods, get_config_path

from noterator import Noterator
from noterator.config import ConfigurationError


class TestConfigValidation(unittest.TestCase):
    def test_valid_config(self):
        noterator = Noterator(
            method=all_available_methods(),
            config_file=get_config_path('config-full.ini')
        )
        noterator._validate_config()

    def test_invalid_config(self):
        noterator = Noterator(
            method=all_available_methods(),
            config_file=get_config_path('config-bad.ini')
        )
        with self.assertRaises(ConfigurationError):
            noterator._validate_config()

    def test_bad_path(self):
        noterator = Noterator(
            config_file='nowhere-useful',
        )
        self.assertEqual(len(noterator.cfg.sections()), 0)

@@ -762,32 +762,76 @@
 or = Noterator(%0A
+            method=all_available_methods(),%0A
             conf
@@ -925,8 +925,102 @@
 ()), 0)%0A
+%0A        with self.assertRaises(ConfigurationError):%0A            noterator._validate_config()%0A

test for missing config sections