#NEWLINE# def test_take_screencap( self ) : #NEWLINE# #INDENT# uuid . uuid4 = ( lambda : 'test_uuid.png' ) #NEWLINE# build_environment = android . BuildEnvironment ( android . BuildEnvironment . build_defaults ( ) ) #NEWLINE# adb_path = build_environment . _find_binary ( android . BuildEnvironment . ADB ) #NEWLINE# test_dest = '/fake/directory/structure.png' #NEWLINE# run_command_mock = common_test . RunCommandMockList ( [ common_test . RunCommandMock ( self , args = ( '%s devices -l' % adb_path ) , stdout = 'List of devices attached\n123456\tdevice\tusb:2-3.4\tproduct:razor\tmodel:Nexus_7\tdevice:flo\n' ) , common_test . RunCommandMock ( self , args = ( '%s -s 123456 shell screencap -p /sdcard/%s' % ( adb_path , uuid . uuid4 ( ) ) ) ) , common_test . RunCommandMock ( self , args = ( '%s -s 123456 pull /sdcard/%s %s' % ( adb_path , uuid . uuid4 ( ) , test_dest ) ) ) , common_test . RunCommandMock ( self , args = ( '%s -s 123456 shell rm /sdcard/%s' % ( adb_path , uuid . uuid4 ( ) ) ) ) ] ) #NEWLINE# build_environment . run_subprocess = run_command_mock #NEWLINE# build_environment . take_screencap ( test_dest , adb_device = '123456' )