How to use the prom2teams.app.configuration._config_provided function in prom2teams

To help you get started, we’ve selected a few prom2teams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github idealista / prom2teams / tests / test_app_configuration.py View on Github external
def test_get_config_overriding_defaults(self):
        provided_config_relative_path = self.TEST_CONFIG_FILES_PATH + 'overriding_defaults.ini'
        config = configuration._config_provided(provided_config_relative_path)

        self.assertEqual(config.get('HTTP Server', 'Host'), '1.1.1.1')
        self.assertEqual(config.get('HTTP Server', 'Port'), '9089')
        self.assertTrue(config.get('Microsoft Teams', 'Connector'))
github idealista / prom2teams / tests / test_app_configuration.py View on Github external
def test_get_config_without_override(self):
        provided_config_relative_path = self.TEST_CONFIG_FILES_PATH + 'without_overriding_defaults.ini'
        config = configuration._config_provided(provided_config_relative_path)

        self.assertTrue(config.get('Microsoft Teams', 'Connector'))
github idealista / prom2teams / tests / test_app_configuration.py View on Github external
def test_get_config_for_all_fields(self):
        provided_config_relative_path = self.TEST_CONFIG_FILES_PATH + 'all_fields.ini'
        config = configuration._config_provided(provided_config_relative_path)

        self.assertEqual(config.get('HTTP Server', 'Host'), '1.1.1.1')
        self.assertEqual(config.get('HTTP Server', 'Port'), '9089')
        self.assertEqual(config.get('Microsoft Teams', 'Connector'), 'some_url')
        self.assertEqual(config.get('Log', 'Level'), 'TEST')
        self.assertEqual(config.get('Log', 'Path'), '/var/log/prom2teams/test.log')
        self.assertEqual(config.get('Template', 'Path'), 'jinja2/template/path')
        self.assertEqual(config.get('Group Alerts', 'Field'), 'name')
github idealista / prom2teams / tests / test_app_configuration.py View on Github external
def test_connectors_configured(self):
        provided_config_relative_path = self.TEST_CONFIG_FILES_PATH + 'multiple_connectors_config.ini'
        config = configuration._config_provided(provided_config_relative_path)

        self.assertEqual(config['Microsoft Teams']['connector1'], 'teams_webhook_url')
        self.assertEqual(config['Microsoft Teams']['connector2'], 'another_teams_webhook_url')
        self.assertEqual(config['Microsoft Teams']['connector3'], 'definitely_another_teams_webhook_url')