diff mbox series

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

Message ID 20210820145759.2180392-2-dja@axtens.net
State Accepted
Headers show
Series [1/2] REST: Don't error if a versioned field we would remove is absent | expand

Commit Message

Daniel Axtens Aug. 20, 2021, 2:57 p.m. UTC
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@axtens.net>
---
 patchwork/tests/api/test_patch.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

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.