def test_setup_secretsdb(self): path = os.path.join(self.tempdir, "secrets.ldb") paths = ProvisionPaths() paths.secrets = path paths.private_dir = os.path.dirname(path) paths.keytab = "no.keytab" paths.dns_keytab = "no.dns.keytab" ldb = setup_secretsdb(paths, None, None, lp=env_loadparm()) try: self.assertEquals("LSA Secrets", ldb.searchone(basedn="CN=LSA Secrets", attribute="CN")) finally: del ldb os.unlink(path)
def test_setup_secretsdb(self): path = os.path.join(self.tempdir, "secrets.ldb") paths = ProvisionPaths() paths.secrets = path paths.private_dir = os.path.dirname(path) paths.keytab = "no.keytab" paths.dns_keytab = "no.dns.keytab" ldb = setup_secretsdb(paths, None, None, lp=env_loadparm()) try: self.assertEquals( "LSA Secrets", ldb.searchone(basedn="CN=LSA Secrets", attribute="CN")) finally: del ldb os.unlink(path)
def create_dummy_secretsdb(path, lp=None): """Create a dummy secrets database for use in tests. :param path: Path to store the secrets db :param lp: Optional loadparm context. A simple one will be generated if not specified. """ if lp is None: lp = env_loadparm() paths = ProvisionPaths() paths.secrets = path paths.private_dir = os.path.dirname(path) paths.keytab = "no.keytab" paths.dns_keytab = "no.dns.keytab" secrets_ldb = setup_secretsdb(paths, None, None, lp=lp) secrets_ldb.transaction_commit() return secrets_ldb