瀏覽代碼

Test that product deletion is handled gracefully in order lines

This was a concern raised by @sampaccoud, and it's best to have
certainty that deleting a product does not impact an order line more
than necessary.
master
Maik Hoepfel 11 年之前
父節點
當前提交
43c7c9e0aa
共有 1 個檔案被更改,包括 9 行新增0 行删除
  1. 9
    0
      tests/integration/order/model_tests.py

+ 9
- 0
tests/integration/order/model_tests.py 查看文件

180
             # Total quantity is too high
180
             # Total quantity is too high
181
             self.event(type, 2)
181
             self.event(type, 2)
182
 
182
 
183
+    def test_handles_product_deletion_gracefully(self):
184
+        product = self.line.product
185
+        product.delete()
186
+        line = Line.objects.get(pk=self.line.pk)
187
+        self.assertIsNone(line.product)
188
+        self.assertIsNone(line.stockrecord)
189
+        self.assertEqual(product.title, line.title)
190
+        self.assertEqual(product.upc, line.upc)
191
+
183
 
192
 
184
 class LineStatusTests(TestCase):
193
 class LineStatusTests(TestCase):
185
 
194
 

Loading…
取消
儲存