diff options
author | 2020-10-08 12:57:40 +0530 | |
---|---|---|
committer | 2020-10-08 12:57:40 +0530 | |
commit | a9074045245d5c301cabc01c79785a2a3f846682 (patch) | |
tree | ad2ba7645997348fb6f732d333b4a4f083d9a96e /pydis_site/apps | |
parent | fix bug: bulk_patch returns duplicate objects in the response (diff) |
add test case: test_returns_400_for_existing_user
Diffstat (limited to 'pydis_site/apps')
-rw-r--r-- | pydis_site/apps/api/tests/test_users.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pydis_site/apps/api/tests/test_users.py b/pydis_site/apps/api/tests/test_users.py index 52f5d213..1569e4d9 100644 --- a/pydis_site/apps/api/tests/test_users.py +++ b/pydis_site/apps/api/tests/test_users.py @@ -154,6 +154,18 @@ class CreationTests(APISubdomainTestCase): response = self.client.post(url, data=data) self.assertEqual(response.status_code, 400) + def test_returns_400_for_existing_user(self): + """Returns 400 if user is already present in DB.""" + url = reverse('bot:user-list', host='api') + data = { + 'id': 11, + 'name': 'You saw nothing part 3.', + 'discriminator': 1122, + 'in_guild': True + } + response = self.client.post(url, data=data) + self.assertEqual(response.status_code, 400) + class MultiPatchTests(APISubdomainTestCase): @classmethod @@ -256,7 +268,6 @@ class MultiPatchTests(APISubdomainTestCase): data = [ { "id": 1, - }, { "id": 2, |