Convert unicode to UTF8 when calling ldap.str2dn()

The string passed to ldap.str2dn() needs to be UTF8 encoded, otherwise
we encounter UnicodeEncodeError exceptions.

This patch adds UTF8 encoding where it was missing for ldap.str2dn()
calls as well as some unit tests to cover the functions that were
lacking this encoding step.

Change-Id: I96e718f1d43f4aad272ca4990d3905a5adf1f07d
Closes-bug: #1375139
Merge "Convert unicode to UTF8 when calling ldap.str2dn()"