This is for Greenwave's API v2: https://pagure.io/greenwave/issue/126
This PR is currently a bit of a mess. It depends on both PR#170 and PR#174, and has some other related fixes in it too. So it will need rebasing and separating into individual PRs.
Also there are still some missing pieces: mainly I want to write proper migration tests, after the kerfuffle around #129. And the POST /api/v1.0/waivers/+filtered endpoint could use more tests.
But I wanted to put this up now so that people can start giving feedback.
Why not use subject_item instead of subject_identifier? Looks more consistent with subject_type filter name and the nested key name ("subject/item") which is listed by the GET request.
subject_item
subject_identifier
subject_type
Oh, sorry, just noticed that it's for v2 and it lists subject_identifier. Never mind then.
Temporary variable for results['data'] would help in this section a bit.
results['data']
Mmm, it is actually strange. But this test is failing for me. Basically, the "valid_results_list" called inside the "+by-subjects-and-testcases" API raises the: ValueError('Must be a list of dictionaries with "subject" and "testcase"')
...because v (=> "case 1") is unicode type and not str as expected. But I don't see anything here in your changes that changed that thing. Am I the only one with this error?
That's my mistake. It works with py.test-3, doesn't work with py.test. Didn't check it for Python 2. PR: #178
py.test-3
py.test
It looks ok to me
Good idea
Okay, now that PR#170 and PR#174 are merged, this is rebased.
Some of the commits in this PR are still not strictly related to the subject_type but they form a neat series and they would just conflict if I separated them out, so I think it's simpler to leave them here. I definitely recommend reviewing the commits individually.
Also, let's leave this unmerged until I finish off the corresponding Greenwave change, so that we can be sure this new API is what we definitely want.
rebased onto 27a4345b17a77f2f5ebd774a1f3e2b6b878cbd1e
5 new commits added
Series ending in commit 395772f is tweaked as per Lukas's suggestion for result['data'], and to tidy up the handling of 'comment' required argument.
:+1:, @dcallagh - looking good.
+1
Note, this will need a rebase now.
Pushed a new series ending in commit a90846d. Rebased it on top of latest master, and fixed pylint's complaint about redefining filter.
filter
rebased onto d2fb36ef68812ccb5875c67b884d9e048ced6e5c
Added an extra commit d225e14 to map 'brew-build' to 'koji_build', as we do in Greenwave.
1 new commit added
map 'brew-build' subjects to koji_build subject type
Added one more commit, to accept unrecognised subject types in /api/v1.0/waivers/+by-subjects-and-testcases, for better backwards compatibility with current Greenwave. We need that because our internal greenwave-dev instance is currently making decisions about certain subjects that don't fit any of our recognised subject types.
Also rebased again due to conflicts with PR#201.
rebased onto 0339d4a327025329a0e144ba61026eae0766eec3
7 new commits added
accept unrecognised subject types in /api/v1.0/waivers/+by-subjects-and-testcases
new POST /api/v1.0/waivers/+filtered endpoint
replace 'subject' with 'subject_type' and 'subject_identifier'
also use RequestParser for making 'comment' required
also use RequestParser for POST /api/v1.0/waivers/+by-subjects-and-testcases
tests: use realistic values for "subject"
Pull-Request has been merged by dcallagh
This is for Greenwave's API v2: https://pagure.io/greenwave/issue/126