コード例 #1
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_with_varied_line_items(self):
        invoice = InvoiceFactory.build()
        invoice.add_line_item("PROD000", 1, 100.00, 0.10)
        invoice.add_line_item("PROD001", 1, 10.00, 0.00)

        self.assertEquals(2, len(invoice.line_items), "Both line items were not added correctly")
        self.assertEquals(100.00, invoice.total_amount(), "Incorrect invoice amount calculated")
コード例 #2
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_with_single_tax_rate(self):
        invoice = InvoiceFactory.build()
        invoice.add_line_item("PROD000", 1, 100.00, 0.20, tax_rate=0.10)

        self.assertEquals(8.00, invoice.tax(), "Incorrect amount of tax calculated")
        self.assertEquals(80.00, invoice.subtotal(), "Incorrect subtotal calculated")
        self.assertEquals(88.00, invoice.total_amount(), "Incorrect total calculated")
コード例 #3
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_is_accepted(self):
        invoice = InvoiceFactory.build()

        self.assertIsNotNone(invoice.invoice_id, "Invoice ID was not set")
        self.assertIsNotNone(invoice.invoice_date, "Invoice date was not set")
        self.assertFalse(invoice.finalised,
                         "Invoice should not have been finalised")
コード例 #4
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_adds_line_item(self):
        invoice = InvoiceFactory.build()
        invoice.add_line_item("PROD000", 1, 100.00, 0.10)

        self.assertEquals(1, len(invoice.line_items),
                          "Line item was not added to Invoice correctly")
        self.assertEquals(90.00, invoice.total_amount(),
                          "Incorrect order amount calculated")
コード例 #5
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_with_varied_line_items(self):
        invoice = InvoiceFactory.build()
        invoice.add_line_item("PROD000", 1, 100.00, 0.10)
        invoice.add_line_item("PROD001", 1, 10.00, 0.00)

        self.assertEquals(2, len(invoice.line_items),
                          "Both line items were not added correctly")
        self.assertEquals(100.00, invoice.total_amount(),
                          "Incorrect invoice amount calculated")
コード例 #6
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_with_single_tax_rate(self):
        invoice = InvoiceFactory.build()
        invoice.add_line_item("PROD000", 1, 100.00, 0.20, tax_rate=0.10)

        self.assertEquals(8.00, invoice.tax(),
                          "Incorrect amount of tax calculated")
        self.assertEquals(80.00, invoice.subtotal(),
                          "Incorrect subtotal calculated")
        self.assertEquals(88.00, invoice.total_amount(),
                          "Incorrect total calculated")
コード例 #7
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_with_invalid_discount_line_item(self):
        invoice = InvoiceFactory.build()
        invoice.add_line_item("PROD000", 1, 1.00, 2.0) # 200% discount

        self.assertEquals(0.0, invoice.total_amount(), "Invoice amount should be zero, not negative")
コード例 #8
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_adds_line_item(self):
        invoice = InvoiceFactory.build()
        invoice.add_line_item("PROD000", 1, 100.00, 0.10)

        self.assertEquals(1, len(invoice.line_items), "Line item was not added to Invoice correctly")
        self.assertEquals(90.00, invoice.total_amount(), "Incorrect order amount calculated")
コード例 #9
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_is_accepted(self):
        invoice = InvoiceFactory.build()

        self.assertIsNotNone(invoice.invoice_id, "Invoice ID was not set")
        self.assertIsNotNone(invoice.invoice_date, "Invoice date was not set")
        self.assertFalse(invoice.finalised, "Invoice should not have been finalised")
コード例 #10
0
ファイル: test_sales.py プロジェクト: jsok/scribbly
    def test_invoice_with_invalid_discount_line_item(self):
        invoice = InvoiceFactory.build()
        invoice.add_line_item("PROD000", 1, 1.00, 2.0)  # 200% discount

        self.assertEquals(0.0, invoice.total_amount(),
                          "Invoice amount should be zero, not negative")