'Test the upload file flows.'

def testUploadFiles(self):

    with test_lib.ConfigOverrider({'FileUploadFileStore.root_dir': self.temp_dir}):
        test_data_path = os.path.join(self.base_path, 'test_img.dd')
        pathspec = rdf_paths.PathSpec(pathtype=rdf_paths.PathSpec.PathType.OS, path=test_data_path)
        session_id = None
        for session_id in flow_test_lib.TestFlowHelper(transfer.MultiUploadFile.__name__, ClientMock(client_id=self.client_id), token=self.token, pathspecs=[pathspec], client_id=self.client_id):
            pass
        results = flow.GRRFlow.ResultCollectionForFID(session_id, token=self.token)
        self.assertEqual(len(results), 1)
        for stat_entry in results:
            fd1 = aff4.FACTORY.Open(stat_entry.AFF4Path(self.client_id), token=self.token)
            fd2 = open(test_data_path, 'rb')
            fd2.seek(0, 2)
            self.assertEqual(fd2.tell(), int(fd1.Get(fd1.Schema.SIZE)))
            self.CompareFDs(fd1, fd2)
