From a9074045245d5c301cabc01c79785a2a3f846682 Mon Sep 17 00:00:00 2001 From: RohanJnr Date: Thu, 8 Oct 2020 12:57:40 +0530 Subject: add test case: test_returns_400_for_existing_user --- pydis_site/apps/api/tests/test_users.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'pydis_site') 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, -- cgit v1.2.3