[PATCH v6 06/10] REST: Add Patches to the API
Finucane, Stephen
stephen.finucane at intel.com
Mon Jun 20 04:19:02 AEST 2016
On 16 Jun 16:13, Andy Doan wrote:
> This exposes patches via the REST API.
>
> Security Constraints:
> * Anyone (logged in or not) can read all objects.
> * No one can create/delete objects.
> * Project maintainers are allowed to update (ie "patch"
> attributes)
>
> NOTE: Patch.save was overridden incorrectly and had to be
> fixed to work with DRF.
>
> Signed-off-by: Andy Doan <andy.doan at linaro.org>
There's an issue with one of the tests below when I run the entire
test suite as one...
> + def test_detail_tags(self):
> + patches = create_patches()
> + patches[0].content = 'Reviewed-by: Test User <test at example.com>\n'
> + patches[0].save()
> + patches[0].refresh_tag_counts()
^ I don't think this is needed (it's called in 'save'), but more
importantly...
> + resp = self.client.get(self.api_url(patches[0].id))
> + tags = resp.data['tags']
> + self.assertEqual(1, len(tags))
The above assertion fails when I run the entire test suite, like so:
tox -e py27
This doesn't seem to be storing tags correctly.
======================================================================
FAIL: test_detail_tags (patchwork.tests.test_rest_api.TestPatchAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/sfinucan/innovation/patchwork/patchwork/patchwork/tests/test_rest_api.py", line 274, in test_detail_tags
self.assertEqual(1, len(tags))
AssertionError: 1 != 0
I'm guessing it's due to some side effect, but I haven't figured out
what's causing this yet. Mind taking a look?
Stephen
More information about the Patchwork
mailing list