Blob Blame History Raw
From 75710952e74ea6070a53baaf5ea4e80507cdc26c Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Thu, 21 Jun 2018 12:37:42 +0200
Subject: [PATCH] TESTS: Allow storing e-mail address for users
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This would allow adding tests for by-e-mail lookups later

Related:
https://pagure.io/SSSD/sssd/issue/3607

Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
(cherry picked from commit d057eb2e20a19ce975dc2202f7c0e9f204eb9510)
---
 src/tests/intg/ldap_ent.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/tests/intg/ldap_ent.py b/src/tests/intg/ldap_ent.py
index a4c987969d3dcefba2af69e095b220180e0fa54c..1f23e3ab7a7ee62909babb8338379a5f2d4e37f2 100644
--- a/src/tests/intg/ldap_ent.py
+++ b/src/tests/intg/ldap_ent.py
@@ -25,7 +25,8 @@ def user(base_dn, uid, uidNumber, gidNumber,
          loginShell=None,
          cn=None,
          sn=None,
-         sshPubKey=()):
+         sshPubKey=(),
+         mail=None):
     """
     Generate an RFC2307(bis) user add-modlist for passing to ldap.add*
     """
@@ -56,6 +57,8 @@ def user(base_dn, uid, uidNumber, gidNumber,
     if len(sshPubKey) > 0:
         pubkeys = [key.encode('utf-8') for key in sshPubKey]
         user[1].append(('sshPublicKey', pubkeys))
+    if mail is not None:
+        user[1].append(('mail', [mail.encode('utf-8')]))
     return user
 
 
@@ -124,7 +127,8 @@ class List(list):
                  loginShell=None,
                  cn=None,
                  sn=None,
-                 sshPubKey=()):
+                 sshPubKey=(),
+                 mail=None):
         """Add an RFC2307(bis) user add-modlist."""
         self.append(user(base_dn or self.base_dn,
                          uid, uidNumber, gidNumber,
@@ -134,7 +138,8 @@ class List(list):
                          loginShell=loginShell,
                          cn=cn,
                          sn=sn,
-                         sshPubKey=sshPubKey))
+                         sshPubKey=sshPubKey,
+                         mail=mail))
 
     def add_group(self, cn, gidNumber, member_uids=[],
                   base_dn=None):
-- 
2.17.1