#248 Add test and fix for ticket #242
Merged 4 years ago by puiterwijk. Opened 4 years ago by puiterwijk.
puiterwijk/ipsilon issue-242  into  master

file modified
+7
@@ -185,6 +185,13 @@ 

          not_mapped = copy.deepcopy(attributes)

          mapped = dict()

  

+         # This is an implicit _* -> _* mapping.

+         # This is done because we expect certain internal attributes (_*) to be

+         # passed along always.

+         for k in attributes:

+             if k.startswith('_'):

+                 mapped[k] = attributes[k]

+ 

          # If ignore_case is True,

          # then PD translates case insensitively prefixes

          PD = dict()

file modified
+29 -1
@@ -232,7 +232,7 @@ 

              'surname': user,

              'givenname': u'Test User 一',

              'email': '%s@example.com' % user,

-             'groups': user

+             'groups': user,

Since this is a style change, I recommend doing it in a separate commit.

          }

          check_info_plugin(sess, idpname, spurl, expect)

      except Exception, e:  # pylint: disable=broad-except
@@ -363,6 +363,34 @@ 

      else:

          print " SUCCESS"

  

+     print "testmapping: Set SP explicit mapping ...",

+     try:

+         sess.set_attributes_and_mapping(

+             idpname,

+             [['fullname', 'wholename'],

+              ['email', 'email']],

+             ['wholename', 'email'],

+             sp['name'])

+     except Exception, e:  # pylint: disable=broad-except

+         print >> sys.stderr, " ERROR: %s" % repr(e)

+         sys.exit(1)

+     else:

+         print " SUCCESS"

+ 

+     print "testmapping: Test SP explicit mapping ...",

+     try:

+         expect = {

+             'wholename': 'Test User %s' % user,

+             'email': '%s@example.com' % user,

+             'NAME_ID': user,

+         }

+         check_info_plugin(sess, idpname, spurl, expect)

+     except Exception, e:  # pylint: disable=broad-except

+         print >> sys.stderr, " ERROR: %s" % repr(e)

+         sys.exit(1)

+     else:

+         print " SUCCESS"

+ 

      print "testmapping: Set SP username mapping ...",

      try:

          sess.set_attributes_and_mapping(

This adds an implicit _ -> _ mapping to assure the admin didn't forget the internal _username -> _username mapping and breaks all login.

2 new commits added

  • Add implicit _ -> _ mapping
  • Add test to check explicit mapping
4 years ago

Since this is a style change, I recommend doing it in a separate commit.

Just one optional suggestion, LGTM!

Commit 74ca9dd fixes this pull-request

Pull-Request has been merged by puiterwijk@redhat.com

4 years ago