aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/tests
diff options
context:
space:
mode:
authorGravatar RohanJnr <[email protected]>2020-10-08 13:51:44 +0530
committerGravatar RohanJnr <[email protected]>2020-10-08 13:51:44 +0530
commit446db59473706c1c44a9a81a6470a87988a99cfb (patch)
treeb1035ff9e1681fadcf7aabc33afe522fa01d71e1 /pydis_site/apps/api/tests
parentraise ValidationError if users have same ID in request data during bulk patch (diff)
add testcase: test_returns_400_for_duplicate_request_users
Diffstat (limited to 'pydis_site/apps/api/tests')
-rw-r--r--pydis_site/apps/api/tests/test_users.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pydis_site/apps/api/tests/test_users.py b/pydis_site/apps/api/tests/test_users.py
index 1569e4d9..8ed56e83 100644
--- a/pydis_site/apps/api/tests/test_users.py
+++ b/pydis_site/apps/api/tests/test_users.py
@@ -276,6 +276,22 @@ class MultiPatchTests(APISubdomainTestCase):
response = self.client.patch(url, data=data)
self.assertEqual(response.status_code, 400)
+ def test_returns_400_for_duplicate_request_users(self):
+ """Return 400 if 2 Users with same ID is passed in the request data."""
+ url = reverse("bot:user-bulk-patch", host="api")
+ data = [
+ {
+ 'id': 1,
+ 'name': 'You saw nothing.',
+ },
+ {
+ 'id': 1,
+ 'name': 'You saw nothing part 2.',
+ }
+ ]
+ response = self.client.patch(url, data=data)
+ self.assertEqual(response.status_code, 400)
+
class UserModelTests(APISubdomainTestCase):
@classmethod