Changeset - ac10ea4ee895
[Not reviewed]
1 6 1
Christopher Neugebauer - 8 years ago 2016-04-07 07:16:04
chrisjrn@gmail.com
s/cart_controller_helper/controller_helpers/
7 files changed with 14 insertions and 7 deletions:
0 comments (0 inline, 0 general)
registrasion/tests/controller_helpers.py
Show inline comments
 
file renamed from registrasion/tests/cart_controller_helper.py to registrasion/tests/controller_helpers.py
registrasion/tests/test_cart.py
Show inline comments
 
import datetime
 
import pytz
 

	
 
from decimal import Decimal
 
from django.contrib.auth.models import User
 
from django.core.exceptions import ObjectDoesNotExist
 
from django.core.exceptions import ValidationError
 
from django.test import TestCase
 

	
 
from registrasion import models as rego
 
from registrasion.controllers.product import ProductController
 

	
 
from cart_controller_helper import TestingCartController
 
from controller_helpers import TestingCartController
 
from patch_datetime import SetTimeMixin
 

	
 
UTC = pytz.timezone('UTC')
 

	
 

	
 
class RegistrationCartTestCase(SetTimeMixin, TestCase):
 

	
 
    def setUp(self):
 
        super(RegistrationCartTestCase, self).setUp()
 

	
 
    @classmethod
 
    def setUpTestData(cls):
registrasion/tests/test_ceilings.py
Show inline comments
 
import datetime
 
import pytz
 

	
 
from django.core.exceptions import ValidationError
 

	
 
from cart_controller_helper import TestingCartController
 
from controller_helpers import TestingCartController
 
from test_cart import RegistrationCartTestCase
 

	
 
from registrasion import models as rego
 

	
 
UTC = pytz.timezone('UTC')
 

	
 

	
 
class CeilingsTestCases(RegistrationCartTestCase):
 

	
 
    def test_add_to_cart_ceiling_limit(self):
 
        self.make_ceiling("Limit ceiling", limit=9)
 
        self.__add_to_cart_test()
registrasion/tests/test_enabling_condition.py
Show inline comments
 
import pytz
 

	
 
from django.core.exceptions import ValidationError
 

	
 
from registrasion import models as rego
 
from registrasion.controllers.category import CategoryController
 
from cart_controller_helper import TestingCartController
 
from controller_helpers import TestingCartController
 
from registrasion.controllers.product import ProductController
 

	
 
from test_cart import RegistrationCartTestCase
 

	
 
UTC = pytz.timezone('UTC')
 

	
 

	
 
class EnablingConditionTestCases(RegistrationCartTestCase):
 

	
 
    @classmethod
 
    def add_product_enabling_condition(cls, mandatory=False):
 
        ''' Adds a product enabling condition: adding PROD_1 to a cart is
registrasion/tests/test_invoice.py
Show inline comments
 
import datetime
 
import pytz
 

	
 
from decimal import Decimal
 
from django.core.exceptions import ValidationError
 

	
 
from registrasion import models as rego
 
from cart_controller_helper import TestingCartController
 
from controller_helpers import TestingCartController
 
from registrasion.controllers.invoice import InvoiceController
 

	
 
from test_cart import RegistrationCartTestCase
 

	
 
UTC = pytz.timezone('UTC')
 

	
 

	
 
class InvoiceTestCase(RegistrationCartTestCase):
 

	
 
    def test_create_invoice(self):
 
        current_cart = TestingCartController.for_user(self.USER_1)
 

	
...
 
@@ -188,13 +188,20 @@ class InvoiceTestCase(RegistrationCartTestCase):
 
        # Should be able to create an invoice after the product is added
 
        current_cart.add_to_cart(self.PROD_1, 1)
 
        invoice_1 = InvoiceController.for_cart(current_cart.cart)
 

	
 
        invoice_1.pay("Reference", invoice_1.invoice.value)
 

	
 
        with self.assertRaises(ValidationError):
 
            invoice_1.void()
 

	
 
    def test_cannot_generate_blank_invoice(self):
 
        current_cart = TestingCartController.for_user(self.USER_1)
 
        with self.assertRaises(ValidationError):
 
            InvoiceController.for_cart(current_cart.cart)
 
            invoice_1 = InvoiceController.for_cart(current_cart.cart)
 

	
 
    # TODO: test partially paid invoice cannot be void until payments
 
    # are refunded
 

	
 
    # TODO: test overpaid invoice results in credit note
 

	
 
    # TODO: test credit note generation more generally 
registrasion/tests/test_refund.py
Show inline comments
 
import pytz
 

	
 
from cart_controller_helper import TestingCartController
 
from controller_helpers import TestingCartController
 
from registrasion.controllers.invoice import InvoiceController
 

	
 
from test_cart import RegistrationCartTestCase
 

	
 
UTC = pytz.timezone('UTC')
 

	
 

	
 
class RefundTestCase(RegistrationCartTestCase):
 

	
 
    def test_refund_marks_void_and_unpaid_and_cart_released(self):
 
        current_cart = TestingCartController.for_user(self.USER_1)
 

	
registrasion/tests/test_voucher.py
Show inline comments
 
import datetime
 
import pytz
 

	
 
from decimal import Decimal
 
from django.core.exceptions import ValidationError
 
from django.db import IntegrityError
 

	
 
from registrasion import models as rego
 
from cart_controller_helper import TestingCartController
 
from controller_helpers import TestingCartController
 
from registrasion.controllers.invoice import InvoiceController
 

	
 
from test_cart import RegistrationCartTestCase
 

	
 
UTC = pytz.timezone('UTC')
 

	
 

	
 
class VoucherTestCases(RegistrationCartTestCase):
 

	
 
    def test_apply_voucher(self):
 
        voucher = self.new_voucher()
 

	
0 comments (0 inline, 0 general)