SMART-42 change status code in response when user profile does not exist

This commit is contained in:
s460930 2020-12-09 21:49:10 +01:00
parent dc2dd3773f
commit f061ad93fe
5 changed files with 2 additions and 2 deletions

Binary file not shown.

View File

@ -30,7 +30,7 @@ class UserProfileApiTest(APITestCase):
user = User.objects.create_user(email='test@test.com', password='test') user = User.objects.create_user(email='test@test.com', password='test')
self.client.force_authenticate(user=user) self.client.force_authenticate(user=user)
response = self.client.get(self.profile_url, format='json') response = self.client.get(self.profile_url, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
self.assertEqual(response.data['success'], 'False') self.assertEqual(response.data['success'], 'False')
def test_get_profile(self): def test_get_profile(self):

View File

@ -30,7 +30,7 @@ class UserProfileView(RetrieveAPIView):
} }
} }
except Exception as e: except Exception as e:
status_code = status.HTTP_400_BAD_REQUEST status_code = status.HTTP_404_NOT_FOUND
response = { response = {
'success': 'False', 'success': 'False',
'status_code': status_code, 'status_code': status_code,