Sto provando a creare un test unitario per verificare che un oggetto sia stato cancellato.Come posso importare l'eccezione DjNo DoesNotExist?
from django.utils import unittest
def test_z_Kallie_can_delete_discussion_response(self):
...snip...
self._driver.get("http://localhost:8000/questions/3/want-a-discussion")
self.assertRaises(Answer.DoesNotExist, Answer.objects.get(body__exact = '<p>User can reply to discussion.</p>'))
continuo a ricevere l'errore:
DoesNotExist: Answer matching query does not exist.
Estranei a mia risposta qui sotto, è quella chiamata get() cancellando la risposta in questione? Se è così, questo dovrebbe davvero essere un DELETE, non un GET. –