我正在尝试创建一个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.
与下面的答案无关,是get()调用删除了有问题的答案吗?如果是这样,那确实应该是DELETE,而不是GET。
—
史蒂夫·贾林