
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()


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)

Make sure config is empty if a bad path is given
Make sure config is empty if a bad path is given

  
  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)
+ 
Make sure config is empty if a bad path is given
## Code Before:

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()

## Instruction:
Make sure config is empty if a bad path is given
## Code After:

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)
