From 2d279f6e717f5466b82d7700d1c2a8ddcec87d88 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Mon, 8 Jan 2018 23:41:33 +0100 Subject: [PATCH] edit tests and config --- boswatch/config.py | 6 +++--- test/test_ServerClient.py | 2 +- test/test_config.py | 24 ++++++++++++------------ test/test_decoder.py | 2 +- test/test_descriptor.py | 2 +- test/test_header.py | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/boswatch/config.py b/boswatch/config.py index d7d3687..4641b96 100644 --- a/boswatch/config.py +++ b/boswatch/config.py @@ -56,10 +56,10 @@ class Config: return False except: self._sharePoints[sharePoint] = self._config - logging.debug("shared configuration as: %s", sharePoint) + logging.debug("configuration sharePoint: %s", sharePoint) return True - def getConfig(self, section, key, sharePoint=""): + def get(self, section, key, sharePoint=""): """!Method to read a single config entry @param section: Section to read from @@ -70,7 +70,7 @@ class Config: try: return self._sharePoints[sharePoint].get(section, key) except KeyError: - logging.error("no shared config named: %s", sharePoint) + logging.error("no sharePoint named: %s", sharePoint) except configparser.NoSectionError: logging.error("no shared config section: %s", section) except configparser.NoOptionError: diff --git a/test/test_ServerClient.py b/test/test_ServerClient.py index d169bdd..1f971f4 100644 --- a/test/test_ServerClient.py +++ b/test/test_ServerClient.py @@ -12,7 +12,7 @@ @file: test_ServerClient.py @date: 10.12.2017 @author: Bastian Schroll -@description: Unittests for BOSWatch. File must be run as "pytest" unittest +@description: Unittests for BOSWatch. File must be _run as "pytest" unittest """ import pytest # import the pytest framework diff --git a/test/test_config.py b/test/test_config.py index e5f7537..8b25ca2 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -12,7 +12,7 @@ @file: test_config.py @date: 08.01.2017 @author: Bastian Schroll -@description: Unittests for BOSWatch. File must be run as "pytest" unittest +@description: Unittests for BOSWatch. File must be _run as "pytest" unittest """ # import pytest # import the pytest framework @@ -34,16 +34,16 @@ class Test_Config: """!get values from local config file""" bwConfig = Config() bwConfig.loadConfigFile(paths.TEST_PATH + "test.ini") - assert bwConfig.getConfig("test", "one") == "1" - assert bwConfig.getConfig("test", "two") == "two" - assert bwConfig.getConfig("testcase", "test") == "ok" + assert bwConfig.get("test", "one") == "1" + assert bwConfig.get("test", "two") == "two" + assert bwConfig.get("testcase", "test") == "ok" def test_getLocalConfigFailed(self): """!fail while get values from local config file""" bwConfig = Config() bwConfig.loadConfigFile(paths.TEST_PATH + "test.ini") - assert bwConfig.getConfig("test", "abc") is None - assert bwConfig.getConfig("abc", "test") is None + assert bwConfig.get("test", "abc") is None + assert bwConfig.get("abc", "test") is None def test_shareConfig(self): """!load local config file and share it""" @@ -65,8 +65,8 @@ class Test_Config: """!try to get values from shared config where not exists""" bwConfig = Config() bwConfig.loadConfigFile(paths.TEST_PATH + "test.ini") - assert bwConfig.getConfig("test", "one") == "1" - assert bwConfig.getConfig("test", "one", "NotSetSharedConfig") is None + assert bwConfig.get("test", "one") == "1" + assert bwConfig.get("test", "one", "NotSetSharedConfig") is None def test_getSharedConfig(self): """!get values from shared config file""" @@ -75,8 +75,8 @@ class Test_Config: assert bwConfig1._sharePoints["test_getSharedConfig"] is not None bwConfig2 = Config() - assert bwConfig2.getConfig("test", "one") is None - assert bwConfig2.getConfig("test", "one", "test_getSharedConfig") == "1" + assert bwConfig2.get("test", "one") is None + assert bwConfig2.get("test", "one", "test_getSharedConfig") == "1" def test_getSharedConfigFailed(self): """!fail while get values from shared config file""" @@ -85,5 +85,5 @@ class Test_Config: assert bwConfig1._sharePoints["test_getSharedConfigFailed"] is not None bwConfig2 = Config() - assert bwConfig2.getConfig("test", "abc", "test_getSharedConfigFailed") is None - assert bwConfig2.getConfig("abc", "test", "test_getSharedConfigFailed") is None + assert bwConfig2.get("test", "abc", "test_getSharedConfigFailed") is None + assert bwConfig2.get("abc", "test", "test_getSharedConfigFailed") is None diff --git a/test/test_decoder.py b/test/test_decoder.py index 790970a..56dec25 100644 --- a/test/test_decoder.py +++ b/test/test_decoder.py @@ -12,7 +12,7 @@ @file: test_decoder.py @date: 15.12.2017 @author: Bastian Schroll -@description: Unittests for BOSWatch. File must be run as "pytest" unittest +@description: Unittests for BOSWatch. File must be _run as "pytest" unittest """ from boswatch.decoder import decoder diff --git a/test/test_descriptor.py b/test/test_descriptor.py index e1c6ce7..40c34f0 100644 --- a/test/test_descriptor.py +++ b/test/test_descriptor.py @@ -12,7 +12,7 @@ @file: test_descriptor.py @date: 07.01.2017 @author: Bastian Schroll -@description: Unittests for BOSWatch. File must be run as "pytest" unittest +@description: Unittests for BOSWatch. File must be _run as "pytest" unittest """ # import pytest # import the pytest framework diff --git a/test/test_header.py b/test/test_header.py index 219b008..e3ba6b8 100644 --- a/test/test_header.py +++ b/test/test_header.py @@ -12,7 +12,7 @@ @file: test_header.py @date: 12.12.2017 @author: Bastian Schroll -@description: Unittests for BOSWatch. File must be run as "pytest" unittest +@description: Unittests for BOSWatch. File must be _run as "pytest" unittest """