コード例 #1
0
    def test_status_invoice(self):
        invoice = MyIntegerInvoide()
        invoice.number = 1234
        invoice.full_clean()
        invoice.save()

        self.assertEqual(invoice.status, 1)
コード例 #2
0
    def test_create_invoice(self):
        invoice = MyIntegerInvoide()
        invoice.number = 1234
        invoice.full_clean()
        invoice.save()

        self.assertTrue(MyIntegerInvoide.objects.count())
コード例 #3
0
    def test_flow_control(self):
        invoice = MyIntegerInvoide()
        invoice.number = 1234
        invoice.full_clean()
        invoice.save()

        self.assertEqual(invoice.status, IntegerChoices.NEW)

        invoice.status = IntegerChoices.INVOICED

        # Raise ValidationError when validate status
        self.assertRaises(exceptions.ValidationError, lambda: invoice.full_clean())