#NEWLINE# def testInterpolateArgs( self ) : #NEWLINE# #INDENT# collect_flow = collectors . ArtifactCollectorFlow ( None , token = self . token ) #NEWLINE# collect_flow . state . Register ( 'knowledge_base' , rdf_client . KnowledgeBase ( ) ) #NEWLINE# collect_flow . current_artifact_name = 'blah' #NEWLINE# collect_flow . state . knowledge_base . MergeOrAddUser ( rdf_client . User ( username = 'test1' ) ) #NEWLINE# collect_flow . state . knowledge_base . MergeOrAddUser ( rdf_client . User ( username = 'test2' ) ) #NEWLINE# collect_flow . args = artifact_utils . ArtifactCollectorFlowArgs ( ) #NEWLINE# test_rdf = rdf_client . KnowledgeBase ( ) #NEWLINE# action_args = { #NEWLINE# #INDENT# 'usernames' : [ '%%users.username%%' , '%%users.username%%' ] , #NEWLINE# 'nointerp' : 'asdfsdf' , #NEWLINE# 'notastring' : test_rdf , #NEWLINE# #UNINDENT# } #NEWLINE# kwargs = collect_flow . InterpolateDict ( action_args ) #NEWLINE# self . assertItemsEqual ( kwargs [ 'usernames' ] , [ 'test1' , 'test2' , 'test1' , 'test2' ] ) #NEWLINE# self . assertEqual ( kwargs [ 'nointerp' ] , 'asdfsdf' ) #NEWLINE# self . assertEqual ( kwargs [ 'notastring' ] , test_rdf ) #NEWLINE# self . assertRaises ( ValueError , collect_flow . InterpolateDict , { #NEWLINE# #INDENT# 'bad' : '%%users.username%%' , #NEWLINE# #UNINDENT# } ) #NEWLINE# list_args = collect_flow . InterpolateList ( [ '%%users.username%%' , '%%users.username%%\\aa' ] ) #NEWLINE# self . assertItemsEqual ( collect_flow , [ 'test1' , 'test2' , 'test1\\aa' , 'test2\\aa' ] ) #NEWLINE# list_args = collect_flow . InterpolateList ( [ 'one' ] ) #NEWLINE# self . assertEqual ( list_args , [ 'one' ] ) #NEWLINE# collect_flow . args . ignore_interpolation_errors = True #NEWLINE# list_args = collect_flow . InterpolateList ( [ '%%users.desktop%%' , '%%users.username%%\\aa' ] ) #NEWLINE# self . assertItemsEqual ( list_args , [ 'test1\\aa' , 'test2\\aa' ] ) #NEWLINE# list_args = collect_flow . InterpolateList ( [ '%%users.desktop%%\\aa' , '%%users.sid%%\\aa' ] ) #NEWLINE# self . assertItemsEqual ( list_args , [ ] )