#NEWLINE# def testAddAndRemoveDuplicates( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# constants . SSHS_SSH_AUTHORIZED_KEYS : ( constants . SSHS_ADD , { #NEWLINE# #INDENT# 'node1' : [ 'key11' , 'key12' ] , #NEWLINE# 'node2' : [ 'key12' ] , #NEWLINE# #UNINDENT# } ) , #NEWLINE# #UNINDENT# } #NEWLINE# ssh_update . UpdateAuthorizedKeys ( data , False , _homedir_fn = self . _GetHomeDir ) #NEWLINE# self . assertEqual ( os . listdir ( self . tmpdir ) , [ '.ssh' ] ) #NEWLINE# self . assertEqual ( sorted ( os . listdir ( self . sshdir ) ) , sorted ( [ 'authorized_keys' ] ) ) #NEWLINE# self . assertEqual ( utils . ReadFile ( utils . PathJoin ( data . sshdir , 'authorized_keys' ) ) , 'key11\nkey12\nkey12\n' ) #NEWLINE# data = { #NEWLINE# #INDENT# constants . SSHS_SSH_AUTHORIZED_KEYS : ( constants . SSHS_REMOVE , { #NEWLINE# #INDENT# 'node1' : [ 'key12' ] , #NEWLINE# #UNINDENT# } ) , #NEWLINE# #UNINDENT# } #NEWLINE# ssh_update . UpdateAuthorizedKeys ( data , False , _homedir_fn = self . _GetHomeDir ) #NEWLINE# self . assertEqual ( utils . ReadFile ( utils . PathJoin ( self . sshdir , 'authorized_keys' ) ) , 'key11\n' )