[PATCH 2/2] tests: test PATCHing a patch in v1.1

Daniel Axtens dja at axtens.net
Sat Aug 21 00:57:59 AEST 2021


This has been broken for a long time and we didn't notice. Weird.
We fixed it, now add a test.

Signed-off-by: Daniel Axtens <dja at axtens.net>
---
 patchwork/tests/api/test_patch.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/patchwork/tests/api/test_patch.py b/patchwork/tests/api/test_patch.py
index da2dd6e9084b..74abd4dff460 100644
--- a/patchwork/tests/api/test_patch.py
+++ b/patchwork/tests/api/test_patch.py
@@ -334,6 +334,20 @@ class TestPatchAPI(utils.APITestCase):
         self.assertEqual(status.HTTP_200_OK, resp.status_code, resp)
         self.assertIsNone(Patch.objects.get(id=patch.id).delegate)
 
+    def test_update_maintainer_v11(self):
+        """Update patch as maintainer on v1.1."""
+        project = create_project()
+        patch = create_patch(project=project)
+        state = create_state()
+        user = create_maintainer(project)
+
+        self.client.force_authenticate(user=user)
+        resp = self.client.patch(self.api_url(patch.id, version="1.1"),
+                                 {'state': state.slug, 'delegate': user.id})
+        self.assertEqual(status.HTTP_200_OK, resp.status_code, resp)
+        self.assertEqual(Patch.objects.get(id=patch.id).state, state)
+        self.assertEqual(Patch.objects.get(id=patch.id).delegate, user)
+
     @utils.store_samples('patch-update-error-bad-request')
     def test_update_invalid_state(self):
         """Update patch with invalid fields.
-- 
2.30.2



More information about the Patchwork mailing list