I have this function which raises the ObjectDoesNotExist
def is_user_login(self,id):
try:
u = m.CustomUser.objects.get(id=id)
except ObjectDoesNotExist as e:
raise e
Now I am writing the test script.
try:
CommonFunc.is_user_login(4)
except Exception as e:
print(e)
self.assertEqual(ObjectDoesNotExist,e)
It doesn't work.
It shows error like this below ,
AssertionError: <class 'django.core.exceptions.ObjectDoesNotExist'> != DoesNotExist('CustomUser matching query does not exist.')
How can I assert for ObjectDoesNotEqual
?