From decf06eb401587c22ede29fbf3da958ac166a638 Mon Sep 17 00:00:00 2001 From: "Ladue, David (dl3158)" Date: Thu, 21 Mar 2019 18:30:01 -0400 Subject: increase pytest coverage Change-Id: I871f5fc3182e0a21b3b4c6d6e033abf8730c8d10 Issue-ID: DCAEGEN2-1264 Signed-off-by: Ladue, David (dl3158) --- tests/test_trapd_get_cbs_config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/test_trapd_get_cbs_config.py') diff --git a/tests/test_trapd_get_cbs_config.py b/tests/test_trapd_get_cbs_config.py index accb986..44bf021 100644 --- a/tests/test_trapd_get_cbs_config.py +++ b/tests/test_trapd_get_cbs_config.py @@ -54,6 +54,21 @@ class test_get_cbs_config(unittest.TestCase): assert pytest_wrapped_sys_exit.value.code == 1 + def test_cbs_override_env_unset(self): + """ + """ + os.environ.update(CBS_SIM_JSON='') + #result = trapd_get_cbs_config.get_cbs_config() + #print("result: %s" % result) + # compare = str(result).startswith("{'snmptrap': ") + # self.assertEqual(compare, False) + + with pytest.raises(SystemExit) as pytest_wrapped_sys_exit: + result = trapd_get_cbs_config.get_cbs_config() + assert pytest_wrapped_sys_exit.type == SystemExit + assert pytest_wrapped_sys_exit.value.code == 1 + + def test_cbs_fallback_env_present(self): """ Test that CBS fallback env variable exists and we can get config -- cgit 1.2.3-korg