'Test that the ListProcesses flow works with filter.'

def testProcessListingWithFilter(self):

    client_mock = ListProcessesMock([rdf_client.Process(pid=2, ppid=1, cmdline=['cmd.exe'], exe='c:\\windows\\cmd.exe', ctime=long((1333718907.167083 * 1000000.0))), rdf_client.Process(pid=3, ppid=1, cmdline=['cmd2.exe'], exe='c:\\windows\\cmd2.exe', ctime=long((1333718907.167083 * 1000000.0))), rdf_client.Process(pid=4, ppid=1, cmdline=['missing_exe.exe'], ctime=long((1333718907.167083 * 1000000.0))), rdf_client.Process(pid=5, ppid=1, cmdline=['missing2_exe.exe'], ctime=long((1333718907.167083 * 1000000.0)))])
    flow_urn = flow.GRRFlow.StartFlow(client_id=self.client_id, flow_name=flow_processes.ListProcesses.__name__, filename_regex='.*cmd2.exe', token=self.token)
    for s in flow_test_lib.TestFlowHelper(flow_urn, client_mock, client_id=self.client_id, token=self.token):
        session_id = s
    processes = flow.GRRFlow.ResultCollectionForFID(session_id, token=self.token)
    self.assertEqual(len(processes), 1)
    self.assertEqual(processes[0].ctime, 1333718907167083L)
    self.assertEqual(processes[0].cmdline, ['cmd2.exe'])
    logs = flow.GRRFlow.LogCollectionForFID(flow_urn, token=self.token)
    for log in logs:
        if ('Skipped    2' in log.log_message):
            return
    raise RuntimeError('Skipped    process    not    mentioned    in    logs')
