<s> """<STR_LIT>""" <EOL> import os <EOL> import ldb <EOL> from ldb import SCOPE_DEFAULT , SCOPE_BASE <EOL> from samba import Ldb , substitute_var <EOL> from samba . tests import TestCaseInTempDir , env_loadparm <EOL> import samba . dcerpc . security <EOL> import samba . ndr <EOL> from samba . auth import system_session <EOL> from operator import attrgetter <EOL> def read_datafile ( filename ) : <EOL> paths = [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> for p in paths : <EOL> datadir = os . path . join ( os . path . dirname ( __file__ ) , p ) <EOL> if os . path . exists ( datadir ) : <EOL> break <EOL> return open ( os . path . join ( datadir , filename ) , '<STR_LIT:r>' ) . read ( ) <EOL> def ldb_debug ( l , text ) : <EOL> print text <EOL> class MapBaseTestCase ( TestCaseInTempDir ) : <EOL> """<STR_LIT>""" <EOL> def setup_modules ( self , ldb , s3 , s4 ) : <EOL> ldb . add ( { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : s4 . basedn , <EOL> "<STR_LIT>" : "<STR_LIT>" + s3 . basedn } ) <EOL> ldb . add ( { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> ldb . add ( { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : [ "<STR_LIT:%s>" % ( s4 . basedn_casefold ) , <EOL> "<STR_LIT:%s>" % ( s3 . basedn_casefold ) ] , <EOL> "<STR_LIT>" : [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> def setUp ( self ) : <EOL> self . lp = env_loadparm ( ) <EOL> self . lp . set ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . lp . set ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> super ( MapBaseTestCase , self ) . setUp ( ) <EOL> def make_dn ( basedn , rdn ) : <EOL> return "<STR_LIT>" % ( rdn , basedn ) <EOL> def make_s4dn ( basedn , rdn ) : <EOL> return "<STR_LIT>" % ( rdn , basedn ) <EOL> self . ldbfile = os . path . join ( self . tempdir , "<STR_LIT>" ) <EOL> self . ldburl = "<STR_LIT>" + self . ldbfile <EOL> tempdir = self . tempdir <EOL> class Target : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , basedn , dn , lp ) : <EOL> self . db = Ldb ( lp = lp , session_info = system_session ( ) ) <EOL> self . db . set_opaque ( "<STR_LIT>" , "<STR_LIT:true>" ) ; <EOL> self . basedn = basedn <EOL> self . basedn_casefold = ldb . Dn ( self . db , basedn ) . get_casefold ( ) <EOL> self . substvars = { "<STR_LIT>" : self . basedn } <EOL> self . file = os . path . join ( tempdir , "<STR_LIT>" % self . basedn_casefold ) <EOL> self . url = "<STR_LIT>" + self . file <EOL> self . _dn = dn <EOL> def dn ( self , rdn ) : <EOL> return self . _dn ( self . basedn , rdn ) <EOL> def connect ( self ) : <EOL> return self . db . connect ( self . url ) <EOL> def setup_data ( self , path ) : <EOL> self . add_ldif ( read_datafile ( path ) ) <EOL> def subst ( self , text ) : <EOL> return substitute_var ( text , self . substvars ) <EOL> def add_ldif ( self , ldif ) : <EOL> self . db . add_ldif ( self . subst ( ldif ) ) <EOL> def modify_ldif ( self , ldif ) : <EOL> self . db . modify_ldif ( self . subst ( ldif ) ) <EOL> self . samba4 = Target ( "<STR_LIT>" , make_s4dn , self . lp ) <EOL> self . samba3 = Target ( "<STR_LIT>" , make_dn , self . lp ) <EOL> self . samba3 . connect ( ) <EOL> self . samba4 . connect ( ) <EOL> def tearDown ( self ) : <EOL> os . unlink ( self . ldbfile ) <EOL> os . unlink ( self . samba3 . file ) <EOL> os . unlink ( self . samba4 . file ) <EOL> pdir = "<STR_LIT>" % self . ldbfile <EOL> mdata = os . path . join ( pdir , "<STR_LIT>" ) <EOL> if os . path . exists ( mdata ) : <EOL> os . unlink ( mdata ) <EOL> os . rmdir ( pdir ) <EOL> super ( MapBaseTestCase , self ) . tearDown ( ) <EOL> def assertSidEquals ( self , text , ndr_sid ) : <EOL> sid_obj1 = samba . ndr . ndr_unpack ( samba . dcerpc . security . dom_sid , <EOL> str ( ndr_sid [ <NUM_LIT:0> ] ) ) <EOL> sid_obj2 = samba . dcerpc . security . dom_sid ( text ) <EOL> self . assertEquals ( sid_obj1 , sid_obj2 ) <EOL> class Samba3SamTestCase ( MapBaseTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( Samba3SamTestCase , self ) . setUp ( ) <EOL> ldb = Ldb ( self . ldburl , lp = self . lp , session_info = system_session ( ) ) <EOL> ldb . set_opaque ( "<STR_LIT>" , "<STR_LIT:true>" ) ; <EOL> self . samba3 . setup_data ( "<STR_LIT>" ) <EOL> ldif = read_datafile ( "<STR_LIT>" ) <EOL> ldb . add_ldif ( self . samba4 . subst ( ldif ) ) <EOL> self . setup_modules ( ldb , self . samba3 , self . samba4 ) <EOL> del ldb <EOL> self . ldb = Ldb ( self . ldburl , lp = self . lp , session_info = system_session ( ) ) <EOL> self . ldb . set_opaque ( "<STR_LIT>" , "<STR_LIT:true>" ) ; <EOL> def test_search_non_mapped ( self ) : <EOL> """<STR_LIT>""" <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] , "<STR_LIT>" ) <EOL> def test_search_non_mapped ( self ) : <EOL> """<STR_LIT>""" <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT:name>" ] ) , "<STR_LIT>" ) <EOL> def test_old_name_of_renamed ( self ) : <EOL> """<STR_LIT>""" <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:0> ) <EOL> def test_mapped_containing_sid ( self ) : <EOL> """<STR_LIT>""" <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] . dn ) , <EOL> "<STR_LIT>" ) <EOL> self . assertTrue ( "<STR_LIT>" in msg [ <NUM_LIT:0> ] ) <EOL> self . assertSidEquals ( "<STR_LIT>" , <EOL> msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) <EOL> oc = set ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) <EOL> self . assertEquals ( oc , set ( [ "<STR_LIT>" ] ) ) <EOL> def test_search_by_objclass ( self ) : <EOL> """<STR_LIT>""" <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertEquals ( set ( [ str ( m . dn ) for m in msg ] ) , <EOL> set ( [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) ) <EOL> def test_s3sam_modify ( self ) : <EOL> self . ldb . add ( { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:foo>" : "<STR_LIT:bar>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } <EOL> ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" , base = "<STR_LIT>" , <EOL> scope = SCOPE_BASE , <EOL> attrs = [ '<STR_LIT:foo>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT:foo>" ] ) , "<STR_LIT:bar>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . ldb . add ( { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:user>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> msg = self . samba3 . db . search ( expression = "<STR_LIT>" ) <EOL> self . assertTrue ( len ( msg ) >= <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , <EOL> "<STR_LIT>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . ldb . modify_ldif ( """<STR_LIT>""" ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertTrue ( len ( msg ) >= <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT>" ) <EOL> self . ldb . modify_ldif ( """<STR_LIT>""" ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertTrue ( len ( msg ) >= <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT>" ) <EOL> self . ldb . modify_ldif ( """<STR_LIT>""" ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertTrue ( len ( msg ) >= <NUM_LIT:1> ) <EOL> self . assertTrue ( not "<STR_LIT:description>" in msg [ <NUM_LIT:0> ] ) <EOL> self . ldb . rename ( "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( msg [ <NUM_LIT:0> ] . dn ) , <EOL> "<STR_LIT>" ) <EOL> self . ldb . delete ( "<STR_LIT>" ) <EOL> msg = self . ldb . search ( expression = "<STR_LIT>" ) <EOL> self . assertEquals ( len ( msg ) , <NUM_LIT:0> ) <EOL> class MapTestCase ( MapBaseTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( MapTestCase , self ) . setUp ( ) <EOL> ldb = Ldb ( self . ldburl , lp = self . lp , session_info = system_session ( ) ) <EOL> ldb . set_opaque ( "<STR_LIT>" , "<STR_LIT:true>" ) ; <EOL> ldif = read_datafile ( "<STR_LIT>" ) <EOL> ldb . add_ldif ( self . samba4 . subst ( ldif ) ) <EOL> self . setup_modules ( ldb , self . samba3 , self . samba4 ) <EOL> del ldb <EOL> self . ldb = Ldb ( self . ldburl , lp = self . lp , session_info = system_session ( ) ) <EOL> self . ldb . set_opaque ( "<STR_LIT>" , "<STR_LIT:true>" ) ; <EOL> def test_map_search ( self ) : <EOL> """<STR_LIT>""" <EOL> self . samba3 . db . add ( { <EOL> "<STR_LIT>" : "<STR_LIT>" + self . samba3 . basedn , <EOL> "<STR_LIT>" : [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } ) <EOL> self . ldb . add_ldif ( """<STR_LIT>""" + self . samba4 . dn ( "<STR_LIT>" ) + """<STR_LIT>""" ) <EOL> self . ldb . add_ldif ( """<STR_LIT>""" + self . samba4 . dn ( "<STR_LIT>" ) + """<STR_LIT>""" ) <EOL> self . ldb . add ( { <EOL> "<STR_LIT>" : self . samba4 . dn ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:Y>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT:y>" , <EOL> "<STR_LIT>" : "<STR_LIT:y>" , <EOL> "<STR_LIT>" : "<STR_LIT:y>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:x>" } ) <EOL> self . ldb . add ( { <EOL> "<STR_LIT>" : self . samba4 . dn ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT:y>" , <EOL> "<STR_LIT>" : "<STR_LIT:z>" , <EOL> "<STR_LIT>" : "<STR_LIT:y>" , <EOL> "<STR_LIT>" : "<STR_LIT:z>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:y>" } ) <EOL> self . samba3 . db . add ( { <EOL> "<STR_LIT>" : self . samba3 . dn ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:A>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> self . samba3 . db . add ( { <EOL> "<STR_LIT>" : self . samba3 . dn ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:B>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT:y>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:x>" } ) <EOL> self . samba3 . db . add ( { <EOL> "<STR_LIT>" : self . samba3 . dn ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:C>" , <EOL> "<STR_LIT>" : "<STR_LIT:x>" , <EOL> "<STR_LIT>" : "<STR_LIT:y>" , <EOL> "<STR_LIT>" : "<STR_LIT:z>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:y>" } ) <EOL> dn = self . samba4 . dn ( "<STR_LIT>" ) <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> dn = self . samba3 . dn ( "<STR_LIT>" ) <EOL> res = self . samba3 . db . search ( dn , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> dn = self . samba4 . dn ( "<STR_LIT>" ) <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> dn = self . samba3 . dn ( "<STR_LIT>" ) <EOL> res = self . samba3 . db . search ( dn , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , scope = SCOPE_DEFAULT , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:2> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> scope = SCOPE_DEFAULT , attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:2> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , scope = SCOPE_DEFAULT , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:2> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , base = None , scope = SCOPE_DEFAULT , attrs = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:4> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertSidEquals ( "<STR_LIT>" , <EOL> res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) <EOL> self . assertTrue ( "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertSidEquals ( "<STR_LIT>" , <EOL> res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) <EOL> self . assertTrue ( "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:2> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] ) , "<STR_LIT:user>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] ) , "<STR_LIT:user>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:3> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , "<STR_LIT:user>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( set ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , set ( [ "<STR_LIT>" ] ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] ) , "<STR_LIT:user>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:2> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:2> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:2> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:2> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:3> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertFalse ( "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertFalse ( "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:3> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertFalse ( "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:6> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:2> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:4> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:6> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:2> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:6> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:6> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:2> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:2> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:5> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:5> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> res = self . ldb . search ( expression = "<STR_LIT>" , attrs = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:7> ) <EOL> res = sorted ( res , key = attrgetter ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:1> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:1> ] [ "<STR_LIT>" ] ) , "<STR_LIT:y>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:2> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:2> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:3> ] [ "<STR_LIT>" ] ) , "<STR_LIT:x>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:4> ] . dn ) , self . samba4 . dn ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:4> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:4> ] [ "<STR_LIT>" ] ) , "<STR_LIT:z>" ) <EOL> dns = [ self . samba4 . dn ( "<STR_LIT>" % n ) for n in [ "<STR_LIT:A>" , "<STR_LIT:B>" , "<STR_LIT:C>" , "<STR_LIT:X>" , "<STR_LIT:Y>" , "<STR_LIT>" ] ] <EOL> for dn in dns : <EOL> self . ldb . delete ( dn ) <EOL> def test_map_modify_local ( self ) : <EOL> """<STR_LIT>""" <EOL> dn = "<STR_LIT>" <EOL> self . ldb . add ( { "<STR_LIT>" : dn , <EOL> "<STR_LIT>" : "<STR_LIT:test>" , <EOL> "<STR_LIT:foo>" : "<STR_LIT:bar>" , <EOL> "<STR_LIT>" : "<STR_LIT:1>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:test>" } ) <EOL> attrs = [ "<STR_LIT:foo>" , "<STR_LIT>" , "<STR_LIT:description>" ] <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:foo>" ] ) , "<STR_LIT:bar>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:1>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> res = self . samba4 . db . search ( expression = "<STR_LIT>" , <EOL> scope = SCOPE_DEFAULT , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> res = self . samba3 . db . search ( expression = "<STR_LIT>" , <EOL> scope = SCOPE_DEFAULT , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> ldif = """<STR_LIT>""" + dn + """<STR_LIT>""" <EOL> self . ldb . modify_ldif ( ldif ) <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:foo>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:1>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:foo>" ) <EOL> dn2 = "<STR_LIT>" <EOL> self . ldb . rename ( dn , dn2 ) <EOL> res = self . ldb . search ( dn2 , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn2 ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:foo>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:1>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:foo>" ) <EOL> self . ldb . delete ( dn2 ) <EOL> res = self . ldb . search ( dn2 , scope = SCOPE_BASE ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> def test_map_modify_remote_remote ( self ) : <EOL> """<STR_LIT>""" <EOL> dn = self . samba4 . dn ( "<STR_LIT>" ) <EOL> dn2 = self . samba3 . dn ( "<STR_LIT>" ) <EOL> self . samba3 . db . add ( { "<STR_LIT>" : dn2 , <EOL> "<STR_LIT>" : "<STR_LIT:test>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:foo>" , <EOL> "<STR_LIT>" : "<STR_LIT:3>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn2 ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:foo>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:3>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , attrs = attrs , expression = "<STR_LIT>" ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:foo>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:3>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> res = self . samba4 . db . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> ldif = """<STR_LIT>""" + dn + """<STR_LIT>""" <EOL> self . ldb . modify_ldif ( ldif ) <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:4>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn2 ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:4>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> dn2 = self . samba4 . dn ( "<STR_LIT>" ) <EOL> self . ldb . rename ( dn , dn2 ) <EOL> dn = dn2 <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:4>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> dn2 = self . samba3 . dn ( "<STR_LIT>" ) <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn2 ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:4>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . ldb . delete ( dn ) <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> def test_map_modify_remote_local ( self ) : <EOL> """<STR_LIT>""" <EOL> dn = self . samba4 . dn ( "<STR_LIT>" ) <EOL> dn2 = self . samba3 . dn ( "<STR_LIT>" ) <EOL> self . samba3 . db . add ( { "<STR_LIT>" : dn2 , <EOL> "<STR_LIT>" : "<STR_LIT:test>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:foo>" , <EOL> "<STR_LIT>" : "<STR_LIT:3>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> ldif = """<STR_LIT>""" + dn + """<STR_LIT>""" <EOL> self . ldb . modify_ldif ( ldif ) <EOL> attrs = [ "<STR_LIT>" , "<STR_LIT:description>" ] <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:1>" ) <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn2 ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> res = self . samba4 . db . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertTrue ( not "<STR_LIT:description>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:1>" ) <EOL> self . ldb . delete ( dn ) <EOL> def test_map_modify_split ( self ) : <EOL> """<STR_LIT>""" <EOL> dn = self . samba4 . dn ( "<STR_LIT>" ) <EOL> dn2 = self . samba3 . dn ( "<STR_LIT>" ) <EOL> self . ldb . add ( { <EOL> "<STR_LIT>" : dn , <EOL> "<STR_LIT>" : "<STR_LIT:test>" , <EOL> "<STR_LIT:description>" : "<STR_LIT:foo>" , <EOL> "<STR_LIT>" : "<STR_LIT:3>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT:1>" } ) <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:foo>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:3>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:1>" ) <EOL> res = self . samba4 . db . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertTrue ( not "<STR_LIT:description>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:1>" ) <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn2 ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:foo>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:3>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> ldif = """<STR_LIT>""" + dn + """<STR_LIT>""" <EOL> self . ldb . modify_ldif ( ldif ) <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:4>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:2>" ) <EOL> res = self . samba4 . db . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertTrue ( not "<STR_LIT:description>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:2>" ) <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn2 ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:4>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> dn2 = self . samba4 . dn ( "<STR_LIT>" ) <EOL> self . ldb . rename ( dn , dn2 ) <EOL> dn = dn2 <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:4>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:2>" ) <EOL> res = self . samba4 . db . search ( dn , scope = SCOPE_BASE , attrs = attrs ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn ) <EOL> self . assertTrue ( not "<STR_LIT:description>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:2>" ) <EOL> dn2 = self . samba3 . dn ( "<STR_LIT>" ) <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE , <EOL> attrs = [ "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] . dn ) , dn2 ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT:description>" ] ) , "<STR_LIT:test>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT:4>" ) <EOL> self . assertEquals ( str ( res [ <NUM_LIT:0> ] [ "<STR_LIT>" ] ) , "<STR_LIT>" ) <EOL> self . assertTrue ( not "<STR_LIT>" in res [ <NUM_LIT:0> ] ) <EOL> self . ldb . delete ( dn ) <EOL> res = self . ldb . search ( dn , scope = SCOPE_BASE ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> res = self . samba4 . db . search ( dn , scope = SCOPE_BASE ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) <EOL> res = self . samba3 . db . search ( dn2 , scope = SCOPE_BASE ) <EOL> self . assertEquals ( len ( res ) , <NUM_LIT:0> ) </s>
