mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2026-04-05 14:25:45 +00:00
edit test_config.py to run with new config methods
This commit is contained in:
parent
9c79757406
commit
9e0aa779ae
2 changed files with 14 additions and 13 deletions
|
|
@ -34,16 +34,17 @@ class Test_Config:
|
|||
"""!get values from local config file"""
|
||||
bwConfig = Config()
|
||||
bwConfig.loadConfigFile(paths.TEST_PATH + "test.ini")
|
||||
assert bwConfig.get("test", "one") == "1"
|
||||
assert bwConfig.get("test", "two") == "two"
|
||||
assert bwConfig.get("testcase", "test") == "ok"
|
||||
assert bwConfig.getInt("test", "one") == 1
|
||||
assert bwConfig.getBool("test", "one") is True
|
||||
assert bwConfig.getStr("test", "two") == "two"
|
||||
assert bwConfig.getStr("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.get("test", "abc") is None
|
||||
assert bwConfig.get("abc", "test") is None
|
||||
assert bwConfig.getStr("test", "abc") == "None"
|
||||
assert bwConfig.getStr("abc", "test") == "None"
|
||||
|
||||
def test_shareConfig(self):
|
||||
"""!load local config file and share it"""
|
||||
|
|
@ -65,8 +66,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.get("test", "one") == "1"
|
||||
assert bwConfig.get("test", "one", "NotSetSharedConfig") is None
|
||||
assert bwConfig.getInt("test", "one") == 1
|
||||
assert bwConfig.getInt("test", "one", "NotSetSharedConfig") == 0
|
||||
|
||||
def test_getSharedConfig(self):
|
||||
"""!get values from shared config file"""
|
||||
|
|
@ -75,8 +76,8 @@ class Test_Config:
|
|||
assert bwConfig1._sharePoints["test_getSharedConfig"] is not None
|
||||
|
||||
bwConfig2 = Config()
|
||||
assert bwConfig2.get("test", "one") is None
|
||||
assert bwConfig2.get("test", "one", "test_getSharedConfig") == "1"
|
||||
assert bwConfig2.getStr("test", "one") == "None"
|
||||
assert bwConfig2.getInt("test", "one", "test_getSharedConfig") == 1
|
||||
|
||||
def test_getSharedConfigFailed(self):
|
||||
"""!fail while get values from shared config file"""
|
||||
|
|
@ -85,5 +86,5 @@ class Test_Config:
|
|||
assert bwConfig1._sharePoints["test_getSharedConfigFailed"] is not None
|
||||
|
||||
bwConfig2 = Config()
|
||||
assert bwConfig2.get("test", "abc", "test_getSharedConfigFailed") is None
|
||||
assert bwConfig2.get("abc", "test", "test_getSharedConfigFailed") is None
|
||||
assert bwConfig2.getStr("test", "abc", "test_getSharedConfigFailed") == "None"
|
||||
assert bwConfig2.getStr("abc", "test", "test_getSharedConfigFailed") == "None"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue