Skipping "upload" tests via API (PATCH requests)

66 views
Skip to first unread message

Ben Shaw

unread,
Jan 7, 2025, 12:07:56 PMJan 7
to QATrack+
Hi,

I am having trouble performing a test list which contains "upload" type tests in a specific way through the API.

My intended use case is a script that can selectively complete part of an in-progress test list, using HTTP PATCH requests. This would add data to a single in-progress test list instance. The test list has multiple "upload" type tests, but I would like to be able to add data to a subset of the tests, which may or may not include one of the upload tests. Using PATCH to modify a subset of tests works fine when there is not an "upload" test in the test list.

I appreciate this isn't really a documented feature, but has anyone else had experience with this or anything similar? I think there could possibly be a more general problem with skipping "upload" tests (API trouble in QATrack), rather than anything specific to what I'm doing?
  • I tried omitting the upload test (when updating other tests) and got a 500 error, with "AttributeError: 'NoneType' object has no attribute 'attachment'" in debug.log
  • I tried requesting and reusing the existing values, which resulted in a 400 error ("[test] is missing the filename field")
  • I tried skipping the upload test, which resulted in a 400 error ("[test] is missing the filename field")
  • I tried setting value:None and filename:None, which resulted in a 400 error ("non_field_errors":["base64 encoding requested but content does not appear to be base64"])
  • I also tried as above with "encoding": "text" and got a 500 error, with "TypeError: object of type 'NoneType' has no len()" in debug.log
If this proves impossible, I will just separate the main test list into multiple separate test lists, each with a single upload test so that I never need to skip it, but wanted to make sure I'd ruled out all possibilities first. 

Thanks,
Ben

Randle Taylor

unread,
Jan 13, 2025, 9:41:16 AMJan 13
to Ben Shaw, QATrack+
Hi Ben,

I understand what you're trying to do I think but the bug with skipping file tests is preventing things from working correctly.  One workaround you might ry is uploading an empty file instead like:

    "tests": {
        "your_upload": {
            "skipped": True,
            "filename": "empty.txt",
            "encoding": "text",
            "value": ""
        },
    },

that should allow you to skip an upload test.

Randy

--
You received this message because you are subscribed to the Google Groups "QATrack+" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qatrack+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/qatrack/70da4da1-33f9-433f-90cb-cf865d968fabn%40googlegroups.com.

Ben Shaw

unread,
Apr 7, 2025, 1:03:45 PMApr 7
to QATrack+
Hi Randy,

Apologies it took me so long to come back to this. Thank you, that did largely work. If I leave "skipped": True in it returns {"non_field_errors":["your_upload is missing the filename field"]} but it works without.

The only other quirk I've found is that after "patching" these test results the values aren't updated immediately, on the website I have to "Continue" and then "Submit QC Results" with "Mark this list as still in progress" ticked for the new file and values to be shown. I haven't looked in enough detail if there's a way I could avoid this but it won't be a huge problem for the workflow I have in mind.

Thanks again for your help here, and all your work on QATrack+,
Ben

Ben Shaw

unread,
Apr 9, 2025, 10:59:14 AMApr 9
to QATrack+
On further testing unfortunately I still don't think I can quite get this to work as I would like, uploading a blank file allows an initial patch with only one "real" file, but I can't then perform further PATCH requests without reuploading existing files - I want to be able to upload one file while leaving existing files in the test list unchanged (e.g. when a new image is available, it will be added to the test list).
I may be missing an obvious solution, but will explore downloading the original file attachment, then re-uploading, although this feels a bit too convoluted and error prone.
Thanks,
Ben
Reply all
Reply to author
Forward
0 new messages