Explorar el Código

Add helper method to basket model to test if submitted

master
David Winterbottom hace 13 años
padre
commit
3284b76425
Se han modificado 2 ficheros con 6 adiciones y 0 borrados
  1. 3
    0
      oscar/apps/basket/abstract_models.py
  2. 3
    0
      tests/unit/basket_tests.py

+ 3
- 0
oscar/apps/basket/abstract_models.py Ver fichero

@@ -418,6 +418,9 @@ class AbstractBasket(models.Model):
418 418
         except ObjectDoesNotExist:
419 419
             return 0
420 420
 
421
+    def is_submitted(self):
422
+        return self.status == SUBMITTED
423
+
421 424
 
422 425
 class AbstractLine(models.Model):
423 426
     """

+ 3
- 0
tests/unit/basket_tests.py Ver fichero

@@ -63,6 +63,9 @@ class TestABasket(TestCase):
63 63
         self.assertEqual(0, self.basket.line_quantity(self.product))
64 64
         self.assertEqual(1, self.basket.line_quantity(self.product, options))
65 65
 
66
+    def test_has_method_to_test_if_submitted(self):
67
+        self.basket.set_as_submitted()
68
+        self.assertTrue(self.basket.is_submitted())
66 69
 
67 70
 
68 71
 class TestBasketMiddleware(TestCase):

Loading…
Cancelar
Guardar