Ejemplo n.º 1
0
    def load_config_section(self, configuration_file, configuration, bot_root):
        oobs = configuration_file.get_section("oob", configuration)
        if oobs is not None:
            oob_keys = configuration_file.get_keys(oobs)

            for name in oob_keys:
                oob = BrainOOBConfiguration(name)
                oob.load_config_section(configuration_file, oobs, bot_root)
                if name == 'default':
                    self._default = oob
                else:
                    self._oobs[name] = oob

        else:
            YLogger.warning(self, "Config section [oobs] missing from Brain, no oobs loaded")
Ejemplo n.º 2
0
    def load_config_section(self, configuration_file, configuration, bot_root):
        oobs = configuration_file.get_section("oob", configuration)
        if oobs is not None:
            oob_keys = configuration_file.get_keys(oobs)

            for name in oob_keys:
                oob = BrainOOBConfiguration(name)
                oob.load_config_section(configuration_file, oobs, bot_root)
                if name == 'default':
                    self._default = oob
                else:
                    self._oobs[name] = oob

        else:
            YLogger.warning(
                self,
                "Config section [oobs] missing from Brain, no oobs loaded")
Ejemplo n.º 3
0
    def test_default_without_data(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text("""
        brain:
            oobs:
                default:
        """, ConsoleConfiguration(), ".")

        brain_config = yaml.get_section("brain")
        self.assertIsNotNone(brain_config)
        oobs_config = yaml.get_section("oobs", brain_config)
        self.assertIsNotNone(oobs_config)

        oob_config = BrainOOBConfiguration("default")
        oob_config.load_config_section(yaml, oobs_config, ".")

        self.assertIsNone(oob_config.classname)
Ejemplo n.º 4
0
    def test_default_without_data(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text("""
        brain:
            oobs:
                default:
        """, ConsoleConfiguration(), ".")

        brain_config = yaml.get_section("brain")
        self.assertIsNotNone(brain_config)
        oobs_config = yaml.get_section("oobs", brain_config)
        self.assertIsNotNone(oobs_config)

        oob_config = BrainOOBConfiguration("default")
        oob_config.load_config_section(yaml, oobs_config, ".")

        self.assertIsNone(oob_config.classname)
Ejemplo n.º 5
0
    def test_oob_with_data(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text("""
        brain:
            oobs:
              default:
                classname: programy.oob.defaults.default.DefaultOutOfBandProcessor
        """, ConsoleConfiguration(), ".")

        brain_config = yaml.get_section("brain")
        self.assertIsNotNone(brain_config)
        oobs_config = yaml.get_section("oobs", brain_config)
        self.assertIsNotNone(oobs_config)

        oob_config = BrainOOBConfiguration("default")
        oob_config.load_config_section(yaml, oobs_config, ".")

        self.assertEqual("programy.oob.defaults.default.DefaultOutOfBandProcessor", oob_config.classname)
Ejemplo n.º 6
0
    def test_oob_with_data(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text("""
        brain:
            oobs:
              default:
                classname: programy.oob.default.DefaultOutOfBandProcessor
        """, ConsoleConfiguration(), ".")

        brain_config = yaml.get_section("brain")
        self.assertIsNotNone(brain_config)
        oobs_config = yaml.get_section("oobs", brain_config)
        self.assertIsNotNone(oobs_config)

        oob_config = BrainOOBConfiguration("default")
        oob_config.load_config_section(yaml, oobs_config, ".")

        self.assertEqual("programy.oob.default.DefaultOutOfBandProcessor", oob_config.classname)
Ejemplo n.º 7
0
 def load_configuration(self, arguments, subs: Substitutions = None):
     super(OOBTestClient, self).load_configuration(arguments)
     default = BrainOOBConfiguration("default")
     default._classname = "programy.oob.defaults.default.DefaultOutOfBandProcessor"
     self.configuration.client_configuration.configurations[
         0].configurations[0].oob._default = default