def test_dn2str_special(): dnstring = 'cn=R\\2cW privilege' dnstring2 = 'cn=R\\,W privilege' expected = [[('cn', 'R,W privilege', 1)]] dn = str2dn(dnstring) assert dn == expected assert dn2str(dn) == dnstring2 assert dn_ctypes.str2dn(dnstring) == dn assert dn_ctypes.dn2str(dn) == dnstring2
def test_str2dn_errors(dnstring): with pytest.raises(DECODING_ERROR): str2dn(dnstring) with pytest.raises(dn_ctypes.DECODING_ERROR): dn_ctypes.str2dn(dnstring)
def test_str2dn2str(dnstring, expected): dn = str2dn(dnstring) assert dn == expected assert dn2str(dn) == dnstring assert dn_ctypes.str2dn(dnstring) == dn assert dn_ctypes.dn2str(dn) == dnstring