Module: check_mk
Branch: master
Commit: 6ce1973663ea404dc088714c4cf4672944fb6383
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6ce1973663ea40…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Apr 9 15:02:22 2019 +0200
Made automation registration test a unit test
Change-Id: Iecc672a1673fdb4d3bfd2d6818047a7b4d80aac0
---
tests/integration/cmk_base/test_automations.py | 60 --------------------------
tests/unit/cmk_base/test_unit_automations.py | 46 ++++++++++++++++++++
2 files changed, 46 insertions(+), 60 deletions(-)
diff --git a/tests/integration/cmk_base/test_automations.py
b/tests/integration/cmk_base/test_automations.py
index b9786a9..728f32b 100644
--- a/tests/integration/cmk_base/test_automations.py
+++ b/tests/integration/cmk_base/test_automations.py
@@ -67,66 +67,6 @@ def test_cfg(web, site):
#.
-# .--Registration--------------------------------------------------------.
-# | ____ _ _ _ _ |
-# | | _ \ ___ __ _(_)___| |_ _ __ __ _| |_(_) ___ _ __ |
-# | | |_) / _ \/ _` | / __| __| '__/ _` | __| |/ _ \| '_ \ |
-# | | _ < __/ (_| | \__ \ |_| | | (_| | |_| | (_) | | | | |
-# | |_| \_\___|\__, |_|___/\__|_| \__,_|\__|_|\___/|_| |_| |
-# | |___/ |
-# +----------------------------------------------------------------------+
-# | Check for the loaded automation plugins |
-# '----------------------------------------------------------------------'
-
-
-def test_registered_automations(site):
- import cmk_base.automations
- automations = cmk_base.automations.automations._automations
-
- needed_automations = [
- 'active-check',
- 'analyse-service',
- 'delete-hosts',
- 'diag-host',
- 'get-agent-output',
- 'get-autochecks',
- 'get-check-information',
- 'get-check-manpage',
- 'get-configuration',
- 'get-real-time-checks',
- 'get-service-configurations',
- 'inventory',
- 'notification-analyse',
- 'notification-get-bulks',
- 'notification-replay',
- 'reload',
- 'rename-hosts',
- 'restart',
- 'scan-parents',
- 'set-autochecks',
- 'try-inventory',
- 'update-dns-cache',
- ]
-
- if site.version.is_enterprise_edition():
- needed_automations += [
- 'bake-agents',
- 'get-package-info',
- 'get-package',
- 'create-package',
- 'edit-package',
- 'install-package',
- 'remove-package',
- 'release-package',
- 'remove-unpackaged-file',
- ]
-
- all_automations = sorted(automations.keys())
-
- assert sorted(needed_automations) == all_automations
-
-
-#.
# .--Autom.calls---------------------------------------------------------.
# | _ _ _ _ |
# | / \ _ _| |_ ___ _ __ ___ ___ __ _| | |___ |
diff --git a/tests/unit/cmk_base/test_unit_automations.py
b/tests/unit/cmk_base/test_unit_automations.py
index 1789606..7e6189b 100644
--- a/tests/unit/cmk_base/test_unit_automations.py
+++ b/tests/unit/cmk_base/test_unit_automations.py
@@ -1,7 +1,53 @@
+import cmk
+import cmk_base.automations
import cmk_base.automations.check_mk as automations
import cmk_base.config as config
+def test_registered_automations(site):
+ needed_automations = [
+ 'active-check',
+ 'analyse-service',
+ 'delete-hosts',
+ 'diag-host',
+ 'get-agent-output',
+ 'get-autochecks',
+ 'get-check-information',
+ 'get-check-manpage',
+ 'get-configuration',
+ 'get-real-time-checks',
+ 'get-service-configurations',
+ 'inventory',
+ 'notification-analyse',
+ 'notification-get-bulks',
+ 'notification-replay',
+ 'reload',
+ 'rename-hosts',
+ 'restart',
+ 'scan-parents',
+ 'set-autochecks',
+ 'try-inventory',
+ 'update-dns-cache',
+ ]
+
+ if cmk.is_enterprise_edition():
+ needed_automations += [
+ 'bake-agents',
+ 'get-package-info',
+ 'get-package',
+ 'create-package',
+ 'edit-package',
+ 'install-package',
+ 'remove-package',
+ 'release-package',
+ 'remove-unpackaged-file',
+ ]
+
+ registered_automations = cmk_base.automations.automations._automations.keys()
+
+ assert sorted(needed_automations) == sorted(registered_automations)
+
+
def test_static_check_rules_of_host(monkeypatch):
as_automation = automations.AutomationAnalyseServices()
assert as_automation.static_check_rules_of("checkgroup_ding",
"test-host") == []