diff --git a/boswatch/__watchdog.py b/boswatch/__watchdog.py deleted file mode 100644 index 05ed5f2..0000000 --- a/boswatch/__watchdog.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -"""! - ____ ____ ______ __ __ __ _____ - / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / - / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < - / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ / -/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/ - German BOS Information Script - by Bastian Schroll - -@file: watchdog.py -@date: ##.##.2018 -@author: Bastian Schroll -@description: Watchdog to _check if BOSWatch client, server, rtl_fm or multimon-ng is still running -""" - -import logging - -logging.debug("- %s loaded", __name__) - - -class Watchdog: - """!Class for an Watchdog to observe, - if needed subprocess still running""" - - def __init__(self): - """!Create a new instance""" - pass diff --git a/test/boswatch/test_config.py b/test/boswatch/test_config.py index 4e3ca10..80fb346 100644 --- a/test/boswatch/test_config.py +++ b/test/boswatch/test_config.py @@ -56,6 +56,12 @@ def test_loadConfigFileNotFound(getConfig): assert getConfig.loadConfigFile(paths.TEST_PATH + "test_configNotFound.yaml") is False +def test_getConfigAsString(getFilledConfig): + """!Get the string representation of the config""" + assert type(str(getFilledConfig)) is str + logging.debug(getFilledConfig) + + def test_getTypes(getFilledConfig): """!Get and check different data types in config""" assert type(getFilledConfig.get("types")) is ConfigYAML @@ -65,6 +71,11 @@ def test_getTypes(getFilledConfig): assert type(getFilledConfig.get("types", "float")) is float +def test_getDefaultValue(getFilledConfig): + """!Get the default value of an not existent entry""" + assert getFilledConfig.get("notExistent", default="defaultValue") == "defaultValue" + + def test_getNestedConfig(getFilledConfig): """!Work with nested sub-config elements""" nestedConfig = getFilledConfig.get("types") @@ -78,4 +89,17 @@ def test_configIterationList(getFilledConfig): for item in getFilledConfig.get("list"): assert type(item) is str counter += 1 - assert counter == 3 + assert counter is 3 + + +def test_configIterationListWithNestedList(getFilledConfig): + """!Try to iterate over a list in the config where its elements are lists itself""" + listCnt = 0 + strCnt = 0 + for item in getFilledConfig.get("list1"): + if type(item) is ConfigYAML: + listCnt += 1 + if type(item) is str: + strCnt += 1 + assert listCnt == 2 + assert strCnt == 1 diff --git a/test/test_config.yaml b/test/test_config.yaml index 5a96119..6840f26 100644 --- a/test/test_config.yaml +++ b/test/test_config.yaml @@ -18,4 +18,15 @@ types: list: - one - two - - three \ No newline at end of file + - three + +list1: + - list11: + - one + - two + - three + - list12: + - one + - two + - three + - string1