SMART-42 change status code in response when user profile does not exist
This commit is contained in:
parent
dc2dd3773f
commit
f061ad93fe
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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):
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user