From 3e6fa054f9567c8ba741969c6961d7f0eda5c1ca Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 26 Feb 2012 15:56:52 +0100 Subject: provision/tests: Test for phpldapadminconfig path. --- .../scripting/python/samba/provision/__init__.py | 2 +- source4/scripting/python/samba/tests/provision.py | 24 +++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py index 526c07a37c..f92ee67be5 100644 --- a/source4/scripting/python/samba/provision/__init__.py +++ b/source4/scripting/python/samba/provision/__init__.py @@ -388,7 +388,7 @@ class ProvisionResult(object): if self.paths.phpldapadminconfig is not None: logger.info( - "A phpLDAPadmin configuration file suitable for administering the Samba 4 LDAP server has been created in %s .", + "A phpLDAPadmin configuration file suitable for administering the Samba 4 LDAP server has been created in %s.", self.paths.phpldapadminconfig) diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py index 937221407e..40665c01f4 100644 --- a/source4/scripting/python/samba/tests/provision.py +++ b/source4/scripting/python/samba/tests/provision.py @@ -147,8 +147,12 @@ class DummyLogger(object): class ProvisionResultTests(TestCase): - def test_report_logger(self): + def report_logger(self, result): logger = DummyLogger() + result.report_logger(logger) + return logger.entries + + def test_basic_report_logger(self): result = ProvisionResult() result.server_role = "domain controller" result.names = ProvisionNames() @@ -157,10 +161,24 @@ class ProvisionResultTests(TestCase): result.names.dnsdomain = "dnsdomein" result.domainsid = "S1-1-1" result.paths = ProvisionPaths() - result.report_logger(logger) - self.assertEquals(logger.entries, [ + entries = self.report_logger(result) + self.assertEquals(entries, [ ('INFO', 'Server Role: domain controller'), ('INFO', 'Hostname: hostnaam'), ('INFO', 'NetBIOS Domain: DOMEIN'), ('INFO', 'DNS Domain: dnsdomein'), ('INFO', 'DOMAIN SID: S1-1-1')]) + + def test_report_logger_phpldapadmin(self): + result = ProvisionResult() + result.server_role = "domain controller" + result.names = ProvisionNames() + result.names.hostname = "hostnaam" + result.names.domain = "DOMEIN" + result.names.dnsdomain = "dnsdomein" + result.domainsid = "S1-1-1" + result.paths = ProvisionPaths() + result.paths.phpldapadminconfig = "/some/ldapconfig" + entries = self.report_logger(result) + self.assertEquals(entries[-1], + ("INFO", "A phpLDAPadmin configuration file suitable for administering the Samba 4 LDAP server has been created in /some/ldapconfig.")) -- cgit