我尝试创建一个 UnitTest 来验证对象是否已被删除。
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>'))
我一直得到这个错误:
DoesNotExist: Answer matching query does not exist.