def test_backwards_compat(self, mock_yamlload): mock_yamlload.return_value = {'backend': 'foobar'} config = load_config(DEFAULT_CONFIG) self.assertIn('backends', config) self.assertEqual(config['backends'], ['foobar'])
if debug_bool: logfile_obj.write( '%s - searching Module-String: %s\n' % (datetime.datetime.now(), modulesearch_str)) if lvlsearch_str in line_str and modulesearch_str in line_str: if not "999" in line_str: #This is to prevent getting a message, everytime a sensor reports a false value timestamp_acst, lvl_str, module_str, message_str = parse( '{} - {} - {} - {}', line_str) if not debug_bool: if not ntfyconfig_str: ntfy.notify( message_str, module_str.strip() + '-' + lvl_str.strip()) else: ntfy.notify(message_str, module_str.strip() + '-' + lvl_str.strip(), config=load_config( ntfyconfig_str.strip())) else: logfile_obj.write( '%s - Notify-Message: %s\n\n' % (datetime.datetime.now(), message_str)) sentmsg_int += 1 logfile_obj.write( '%s - %s read and %d messages sent.\n' % (datetime.datetime.now(), tplog_str.strip(), sentmsg_int)) logfile_obj.close() #close TePiNot-log
def test_default_config(self): config = load_config(DEFAULT_CONFIG) self.assertEqual(config, {})
def test_default_config(self): config = load_config('~/.ntfy.yml') self.assertEqual(config, {'backends': ['default']})