コード例 #1
0
class TestAllocations(TestCase):
    def setUp(self):
        self.allocations = Allocations()

    def test_have_default_total_of_zero(self):
        self.assertEqual(D("0.00"), self.allocations.total)

    def test_has_items_interface(self):
        self.allocations.add("A", D("10.00"))

        for code, amount in list(self.allocations.items()):
            self.assertEqual("A", code)
            self.assertEqual(D("10.00"), amount)

    def test_allow_items_to_be_removed(self):
        self.allocations.add("A", D("10.00"))
        self.assertEqual(D("10.00"), self.allocations.total)
        self.allocations.remove("A")
        self.assertEqual(D("0.00"), self.allocations.total)
コード例 #2
0
class TestAllocations(TestCase):
    def setUp(self):
        self.allocations = Allocations()

    def test_have_default_total_of_zero(self):
        self.assertEqual(D('0.00'), self.allocations.total)

    def test_has_items_interface(self):
        self.allocations.add('A', D('10.00'))

        for code, amount in self.allocations.items():
            self.assertEqual('A', code)
            self.assertEqual(D('10.00'), amount)

    def test_allow_items_to_be_removed(self):
        self.allocations.add('A', D('10.00'))
        self.assertEqual(D('10.00'), self.allocations.total)
        self.allocations.remove('A')
        self.assertEqual(D('0.00'), self.allocations.total)
コード例 #3
0
class TestAllocations(TestCase):

    def setUp(self):
        self.allocations = Allocations()

    def test_have_default_total_of_zero(self):
        self.assertEqual(D('0.00'), self.allocations.total)

    def test_has_items_interface(self):
        self.allocations.add('A', D('10.00'))

        for code, amount in self.allocations.items():
            self.assertEqual('A', code)
            self.assertEqual(D('10.00'), amount)

    def test_allow_items_to_be_removed(self):
        self.allocations.add('A', D('10.00'))
        self.assertEqual(D('10.00'), self.allocations.total)
        self.allocations.remove('A')
        self.assertEqual(D('0.00'), self.allocations.total)
コード例 #4
0
 def setUp(self):
     self.allocations = Allocations()
コード例 #5
0
 def get_account_allocations(self):
     return self.checkout_session._get('accounts', 'allocations',
                                       Allocations())
コード例 #6
0
 def setUp(self):
     self.allocations = Allocations()