Esempio n. 1
0
 def test_load_configuration_from_file(self):
     with self.assertRaises(Exception):
         ConfigurationFactory.load_configuration_from_file(
             ConsoleConfiguration(), "file.txt", file_format=None)
     with self.assertRaises(Exception):
         ConfigurationFactory.load_configuration_from_file(
             ConsoleConfiguration(), "file.txt", file_format="")
Esempio n. 2
0
    def load_configuration(self, arguments):
        if arguments.bot_root is None:
            arguments.bot_root = os.path.dirname(arguments.config_filename)
            print("No bot root argument set, defaulting to [%s]" % arguments.bot_root)

        self.configuration = self.get_client_configuration()

        ConfigurationFactory.load_configuration_from_file(self.configuration, arguments.config_filename,
                                                          arguments.config_format, arguments.bot_root)
Esempio n. 3
0
    def load_configuration(self, arguments):
        if arguments.bot_root is None:
            arguments.bot_root = os.path.dirname(arguments.config_filename)
            print("No bot root argument set, defaulting to [%s]" % arguments.bot_root)

        self.configuration = self.get_client_configuration()

        ConfigurationFactory.load_configuration_from_file(self.configuration, arguments.config_filename,
                                                          arguments.config_format, arguments.bot_root)
Esempio n. 4
0
    def load_configuration(self, arguments):
        if arguments.bot_root is None:
            if arguments.config_filename is not None:
                arguments.bot_root = os.path.dirname(arguments.config_filename)
            else:
                arguments.bot_root = "."
            print("No bot root argument set, defaulting to [%s]" % arguments.bot_root)

        if arguments.config_filename is not None:
            self.configuration = ConfigurationFactory.load_configuration_from_file(self.get_client_configuration(), arguments.config_filename, arguments.config_format, arguments.bot_root)
        else:
            print ("No configuration file specified, using defaults only !")
            self.configuration = ProgramyConfiguration(self.get_client_configuration())
Esempio n. 5
0
    def load_configuration(self, arguments):
        if arguments.bot_root is None:
            if arguments.config_filename is not None:
                arguments.bot_root = os.path.dirname(arguments.config_filename)
            else:
                arguments.bot_root = "."
            print("No bot root argument set, defaulting to [%s]" % arguments.bot_root)

        if arguments.config_filename is not None:
            self._configuration = ConfigurationFactory.load_configuration_from_file(self.get_client_configuration(),
                                                                                   arguments.config_filename,
                                                                                   arguments.config_format,
                                                                                   arguments.bot_root)
        else:
            print("No configuration file specified, using defaults only !")
            self._configuration = ProgramyConfiguration(self.get_client_configuration())
Esempio n. 6
0
    def load_configuration(self, arguments, subs: Substitutions = None):
        if arguments.bot_root is None:
            if arguments.config_filename is not None:
                arguments.bot_root = os.path.dirname(arguments.config_filename)
            else:
                arguments.bot_root = "."
            outputLog(self, "No bot root argument set, defaulting to [%s]" % arguments.bot_root)

        if arguments.config_filename is not None:
            self._configuration = ConfigurationFactory.load_configuration_from_file(self.get_client_configuration(),
                                                                                    arguments.config_filename,
                                                                                    arguments.config_format,
                                                                                    arguments.bot_root,
                                                                                    subs)
        else:
            outputLog(self, "No configuration file specified, using defaults only !")
            self._configuration = ProgramyConfiguration(self.get_client_configuration())
Esempio n. 7
0
 def load_configuration(self, arguments):
     self.configuration = ClientConfiguration()
     ConfigurationFactory.load_configuration_from_file(
         self.configuration,
         os.path.dirname(__file__) + "/testconfig.yaml")
Esempio n. 8
0
 def load_configuration(self, arguments):
     self._configuration = ConfigurationFactory.load_configuration_from_file(ConsoleConfiguration(),
                                                                            os.path.dirname(__file__)+ os.sep + "testconfig.yaml",
                                                                            bot_root=os.path.dirname(__file__))
Esempio n. 9
0
 def test_load_config_data_xml(self):
     config_data = ConfigurationFactory.load_configuration_from_file(ConsoleConfiguration(), os.path.dirname(__file__)+ os.sep + "test_xml.xml")
     self.assert_configuration(config_data)
Esempio n. 10
0
 def load_configuration(self, arguments):
     self.configuration = ConfigurationFactory.load_configuration_from_file(
         ConsoleConfiguration(),
         os.path.dirname(__file__) + os.sep + "testconfig.yaml",
         bot_root=os.path.dirname(__file__))
Esempio n. 11
0
 def test_load_config_data_xml(self):
     config_data = ConfigurationFactory.load_configuration_from_file(ConsoleConfiguration(), os.path.dirname(__file__)+ os.sep + "test_xml.xml")
     self.assert_configuration(config_data)
Esempio n. 12
0
 def test_load_config_data_yaml(self):
     client_config = ClientConfiguration()
     ConfigurationFactory.load_configuration_from_file(
         client_config,
         os.path.dirname(__file__) + "/test_yaml.yaml")
     self.assert_config_data(client_config)
Esempio n. 13
0
 def load_configuration(self, arguments):
     self.configuration = ClientConfiguration()
     ConfigurationFactory.load_configuration_from_file(self.configuration, os.path.dirname(__file__)+"/testconfig.yaml")
 def test_load_config_data_json(self):
     config_data = ConfigurationFactory.load_configuration_from_file(ConsoleConfiguration(), os.path.dirname(__file__)+"/test_json.json")
     self.assert_configuration(config_data)
Esempio n. 15
0
 def test_load_config_data_yaml(self):
     client_config = ClientConfiguration()
     ConfigurationFactory.load_configuration_from_file(client_config, os.path.dirname(__file__)+"/test_yaml.yaml")
     self.assert_config_data(client_config)