Ejemplo n.º 1
0
    def test_config_read_from_path(self):
        """ Tests providing or not providing a configuration file works as expected"""
        # No config file provided
        super().assertEqual(None, self.config.file_path)

        # Correct config file provided

        file_path = os.path.join(
            os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         os.pardir), 'config.ini')
        Config.clear_instance()
        self.config = Config(file_path)
        super().assertEqual(file_path, self.config.file_path)

        # Bad path provided
        Config.clear_instance()
        self.config = Config('')
        super().assertEqual(None, self.config.file_path)
Ejemplo n.º 2
0
 def tearDown(self) -> None:
     """ Destroy Config instance """
     Config.clear_instance()
Ejemplo n.º 3
0
    def test_config_is_clearable(self):
        """ Tests its possible to renew the singleton instance """
        Config.clear_instance()
        another_config = Config()

        super().assertNotEqual(self.config, another_config)
Ejemplo n.º 4
0
 def tearDown(self) -> None:
     """ Destroy Config instance, reset Underscore's token extensions """
     Config.clear_instance()
     Underscore.token_extensions = {}