From c7408f67f6cff7bd3ac14b7661472898f8e7dd73 Mon Sep 17 00:00:00 2001 From: Oleg Fayans Date: Thu, 27 Aug 2015 19:19:28 +0200 Subject: Integration tests for topology plugin Reviewed-By: Martin Basti Reviewed-By: Tomas Babej --- ipatests/test_ipaserver/test_topology_plugin.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'ipatests/test_ipaserver/test_topology_plugin.py') diff --git a/ipatests/test_ipaserver/test_topology_plugin.py b/ipatests/test_ipaserver/test_topology_plugin.py index 667897499..b162822e0 100644 --- a/ipatests/test_ipaserver/test_topology_plugin.py +++ b/ipatests/test_ipaserver/test_topology_plugin.py @@ -2,18 +2,23 @@ # Copyright (C) 2015 FreeIPA Contributors see COPYING for license # +import io import os from ipaserver.plugins.ldap2 import ldap2 from ipalib import api from ipapython import ipautil from ipapython.dn import DN -import nose +import pytest class TestTopologyPlugin(object): """ Test Topology plugin from the DS point of view + Testcase: http://www.freeipa.org/page/V4/Manage_replication_topology/ + Test_plan#Test_case: + _Replication_Topology_is_listed_among_directory_server_plugins """ + pwfile = os.path.join(api.env.dot_ipa, ".dmpw") def setup(self): """ @@ -25,6 +30,8 @@ class TestTopologyPlugin(object): if self.conn and self.conn.isconnected(): self.conn.disconnect() + @pytest.mark.skipif(ipautil.file_exists(pwfile) is False, + reason="You did not provide a .dmpw file with the DM password") def test_topologyplugin(self): pluginattrs = { u'nsslapd-pluginPath': [u'libtopology'], @@ -56,11 +63,8 @@ class TestTopologyPlugin(object): ('cn', 'plugins'), ('cn', 'config')) pwfile = os.path.join(api.env.dot_ipa, ".dmpw") - if ipautil.file_exists(pwfile): - with open(pwfile, "r") as f: - dm_password = f.read().rstrip() - else: - raise nose.SkipTest("No directory manager password in %s" % pwfile) + with io.open(pwfile, "r") as f: + dm_password = f.read().rstrip() self.conn = ldap2(api) self.conn.connect(bind_dn=DN(('cn', 'directory manager')), bind_pw=dm_password) -- cgit