'Test we overwrite the collection every time the flow is executed.'

def testCollectionOverwriting(self):

    client_mock = action_mocks.ActionMock(searching.Find)
    findspec = rdf_client.FindSpec()
    findspec.path_regex = 'bin'
    findspec.pathspec.path = '/'
    findspec.pathspec.pathtype = rdf_paths.PathSpec.PathType.OS
    for s in flow_test_lib.TestFlowHelper(find.FindFiles.__name__, client_mock, client_id=self.client_id, token=self.token, findspec=findspec):
        session_id = s
    fd = flow.GRRFlow.ResultCollectionForFID(session_id, token=self.token)
    self.assertEqual(len(fd), 2)
    findspec.path_regex = 'dd'
    for s in flow_test_lib.TestFlowHelper(find.FindFiles.__name__, client_mock, client_id=self.client_id, token=self.token, findspec=findspec, max_results=1):
        session_id = s
    fd = flow.GRRFlow.ResultCollectionForFID(session_id, token=self.token)
    self.assertEqual(len(fd), 1)
