Module: check_mk
Branch: master
Commit: 533703264e3ee9e47f0812fd3e71d6c7c16612e0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=533703264e3ee9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Mar 7 18:43:48 2018 +0100
test_automation_set_autochecks: Cleanup created file after test
Change-Id: I38269f4155ee7cccc85050608fa0fee6fd769b2a
---
tests/cmk_base/test_automations.py | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/tests/cmk_base/test_automations.py b/tests/cmk_base/test_automations.py
index cc3b6f8..2c196b5 100644
--- a/tests/cmk_base/test_automations.py
+++ b/tests/cmk_base/test_automations.py
@@ -283,17 +283,23 @@ def test_automation_set_autochecks(test_cfg, site):
("uptime", None) : None,
}
- data = _execute_automation(site, "set-autochecks",
- args=["blablahost"], stdin=repr(new_items))
- assert data == None
+ try:
+ data = _execute_automation(site, "set-autochecks",
+ args=["blablahost"], stdin=repr(new_items))
+ assert data == None
- data = _execute_automation(site, "get-autochecks",
- args=["blablahost"])
+ data = _execute_automation(site, "get-autochecks",
+ args=["blablahost"])
- assert sorted(data) == sorted([
- ('df', u'xxx', 'bla', "'bla'"),
- ('uptime', None, None, 'None')
- ])
+ assert sorted(data) == sorted([
+ ('df', u'xxx', 'bla', "'bla'"),
+ ('uptime', None, None, 'None')
+ ])
+
+ assert site.file_exists("var/check_mk/autochecks/blablahost.mk")
+ finally:
+ if site.file_exists("var/check_mk/autochecks/blablahost.mk"):
+ site.delete_file("var/check_mk/autochecks/blablahost.mk")
def test_automation_update_dns_cache(test_cfg, site, web):