<s> """<STR_LIT>""" <EOL> from grr . endtoend_tests import transfer <EOL> from grr . lib import aff4 <EOL> from grr . lib import flow_runner <EOL> from grr . lib . flows . general import file_finder <EOL> class TestFileFinderOSWindows ( transfer . TestGetFileOSWindows ) : <EOL> """<STR_LIT>""" <EOL> flow = "<STR_LIT>" <EOL> test_output_path = "<STR_LIT>" <EOL> sizecondition = file_finder . FileFinderSizeCondition ( max_file_size = <NUM_LIT> ) <EOL> filecondition = file_finder . FileFinderCondition ( <EOL> condition_type = file_finder . FileFinderCondition . Type . SIZE , <EOL> size = sizecondition ) <EOL> download = file_finder . FileFinderDownloadActionOptions ( ) <EOL> action = file_finder . FileFinderAction ( <EOL> action_type = file_finder . FileFinderAction . Action . DOWNLOAD , <EOL> download = download ) <EOL> args = { "<STR_LIT>" : [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : filecondition , "<STR_LIT:action>" : action } <EOL> class TestFileFinderTSKWindows ( TestFileFinderOSWindows ) : <EOL> download = file_finder . FileFinderDownloadActionOptions ( ) <EOL> action = file_finder . FileFinderAction ( <EOL> action_type = file_finder . FileFinderAction . Action . DOWNLOAD , <EOL> download = download ) <EOL> test_output_path = "<STR_LIT>" <EOL> args = { "<STR_LIT>" : [ "<STR_LIT>" ] , <EOL> "<STR_LIT:action>" : action , "<STR_LIT>" : "<STR_LIT>" } <EOL> class TestFileFinderOSLinux ( transfer . TestGetFileOSLinux ) : <EOL> """<STR_LIT>""" <EOL> platforms = [ "<STR_LIT>" ] <EOL> flow = "<STR_LIT>" <EOL> test_output_path = "<STR_LIT>" <EOL> sizecondition = file_finder . FileFinderSizeCondition ( max_file_size = <NUM_LIT> ) <EOL> filecondition = file_finder . FileFinderCondition ( <EOL> condition_type = file_finder . FileFinderCondition . Type . SIZE , <EOL> size = sizecondition ) <EOL> download = file_finder . FileFinderDownloadActionOptions ( ) <EOL> action = file_finder . FileFinderAction ( <EOL> action_type = file_finder . FileFinderAction . Action . DOWNLOAD , <EOL> download = download ) <EOL> args = { "<STR_LIT>" : [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : filecondition , "<STR_LIT:action>" : action } <EOL> class TestFileFinderOSLinuxProc ( transfer . TestGetFileOSLinux ) : <EOL> """<STR_LIT>""" <EOL> platforms = [ "<STR_LIT>" ] <EOL> flow = "<STR_LIT>" <EOL> test_output_path = "<STR_LIT>" <EOL> client_min_version = <NUM_LIT> <EOL> sizecondition = file_finder . FileFinderSizeCondition ( max_file_size = <NUM_LIT> ) <EOL> filecondition = file_finder . FileFinderCondition ( <EOL> condition_type = file_finder . FileFinderCondition . Type . SIZE , <EOL> size = sizecondition ) <EOL> download = file_finder . FileFinderDownloadActionOptions ( ) <EOL> action = file_finder . FileFinderAction ( <EOL> action_type = file_finder . FileFinderAction . Action . DOWNLOAD , <EOL> download = download ) <EOL> args = { "<STR_LIT>" : [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : filecondition , "<STR_LIT:action>" : action } <EOL> def CheckFile ( self , fd ) : <EOL> data = fd . Read ( <NUM_LIT:10> ) <EOL> self . assertTrue ( data ) <EOL> class TestFileFinderOSDarwin ( TestFileFinderOSLinux ) : <EOL> platforms = [ "<STR_LIT>" ] <EOL> def CheckFile ( self , fd ) : <EOL> self . CheckMacMagic ( fd ) <EOL> class TestFileFinderOSHomedir ( TestFileFinderOSLinux ) : <EOL> """<STR_LIT>""" <EOL> platforms = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> test_output_path = "<STR_LIT>" <EOL> action = file_finder . FileFinderAction ( <EOL> action_type = file_finder . FileFinderAction . Action . STAT ) <EOL> args = { "<STR_LIT>" : [ "<STR_LIT>" ] , "<STR_LIT:action>" : action , <EOL> "<STR_LIT>" : flow_runner . FlowRunnerArgs ( output = test_output_path ) } <EOL> def CheckFlow ( self ) : <EOL> results = aff4 . FACTORY . Open ( self . client_id . Add ( self . test_output_path ) , <EOL> token = self . token ) <EOL> self . assertEqual ( type ( results ) , aff4 . RDFValueCollection ) <EOL> self . assertTrue ( len ( results ) > <NUM_LIT:1> ) </s>
