Upload file not working correctly

Issue #129 resolved
Wenze van Klink created an issue

As I was working on issue #126 I found some bugs in the file upload.

First thing is that when no file is attached and "Mark this list as still in progress" is selected the 'tmp' folder is moved. This is because the only checks are if the test is a file-upload and if it is skipped or not. There should also be checked if a file is uploaded. The following code works: perform.py line 509

        for delta, ti_form in enumerate(formset):
            if ti_form.unit_test_info.test.is_upload() and not ti_form.cleaned_data["skipped"] and \
                            len(ti_form.cleaned_data["string_value"]) > 0:
                fname = ti_form.cleaned_data["string_value"]
                src = os.path.join(settings.TMP_UPLOAD_ROOT, fname)
                d = os.path.join(settings.UPLOAD_ROOT, "%s" % self.object.pk)
                if not os.path.exists(d):
                    os.mkdir(d)
                dest = os.path.join(settings.UPLOAD_ROOT, d, fname)
                shutil.move(src, dest)

The second problem is that if a TestList is marked as in progress and a file is attached when it is resumed the file doesn't get moved from the tmp folder. To me it seems that the code to do that is missing from EditTestListInstance. But I'm not sure how to fix it.

Comments (8)

  1. Wenze van Klink reporter
    • changed status to open

    I still have this problem when doing the following:

    1. Add file on a testlist, select as in progress and submit
    2. Continue testlist, add a new file and submit

    This gives an error: No such file or directory uploads\tmp\Alignment_60_2014-04-09_da16dd.jpg'

    The file is already in the folder of the testlistinstance.

    Can you reproduce this in 0.2.8. Randle?

  2. Randle Taylor

    Hmm...I'm not able to reproduce this problem in 0.2.8 taking exactly the steps you have. Where are you seeing that error?

  3. Randle Taylor

    I take that back...I've now been able to reproduce a similar error. I'll investigate some more.

  4. Aditya Panchal

    I am noticing a strange bug that when you submit a test list with an upload and re-submit (i.e. to change the timestamp) QATrack+ will try to re-copy the uploaded files from tmp to the final destination folder. However, since the files have already been moved from the original submission, the process fails.

    Manually copying the files back to tmp will temporarily solve this issue.

  5. Log in to comment