Esempio n. 1
0
    def test_for_yml(self):
        file_path = "file.yml"

        with self.assertLogs("rabbit_force.config", "DEBUG") as log:
            result = get_config_loader(file_path)

        self.assertIs(result, yaml.safe_load)
        self.assertEqual(log.output, [
            f"DEBUG:rabbit_force.config:Using YAML config loader for "
            f"{file_path!r}"
        ])
Esempio n. 2
0
    def test_for_empty_file_path(self):
        file_path = ""

        with self.assertLogs("rabbit_force.config", "DEBUG") as log:
            result = get_config_loader(file_path)

        self.assertIsNone(result)
        self.assertEqual(log.output, [
            f"DEBUG:rabbit_force.config:No config loader found for "
            f"{file_path!r}"
        ])
Esempio n. 3
0
    def test_for_json(self):
        file_path = "file.json"

        with self.assertLogs("rabbit_force.config", "DEBUG") as log:
            result = get_config_loader(file_path)

        self.assertIs(result, json.load)
        self.assertEqual(log.output, [
            f"DEBUG:rabbit_force.config:Using JSON config loader for "
            f"{file_path!r}"
        ])