Module: check_mk
Branch: master
Commit: 0666196e085bd13e182b0e45e8221748ea42563b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0666196e085bd1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 29 14:53:18 2016 +0200
Minor cleanup
---
tests/testlib/__init__.py | 5 ++---
tests/web/test_login.py | 8 +++-----
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 5b1d9e9..73bfc89 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -364,9 +364,8 @@ class WebSession(requests.Session):
#
def _automation_credentials(self):
- p = self.site.execute(["cat",
"%s/var/check_mk/web/cmkautomation/automation.secret" %
-
self.site.root ],
- stdout=subprocess.PIPE)
+ secret_path = "%s/var/check_mk/web/cmkautomation/automation.secret" %
self.site.root
+ p = self.site.execute(["cat", secret_path], stdout=subprocess.PIPE)
secret = p.communicate()[0].rstrip()
return {
diff --git a/tests/web/test_login.py b/tests/web/test_login.py
index 5e1de88..5e03191 100644
--- a/tests/web/test_login.py
+++ b/tests/web/test_login.py
@@ -4,14 +4,12 @@
import pytest
from testlib import site, web
-# The web fixture of testlib is doing the login automatically
-def test_01_login(site, web):
+# The web fixture of testlib is doing the login automatically. Check access to a page
+# and then logout and check for disabled access.
+def test_01_login_and_logout(site, web):
r = web.get(site.url + "wato.py")
assert "Global Settings" in r.text
-
-def test_02_logout(site, web):
web.logout()
-
r = web.get(site.url + "wato.py")
assert "Global Settings" not in r.text