Exemple #1
0
    def test_flow_control(self):
        invoice = MyCharInvoide()
        invoice.number = 1234
        invoice.full_clean()
        invoice.save()

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

        invoice.status = CharChoices.INVOICED

        # Raise ValidationError when validate status
        self.assertRaises(exceptions.ValidationError, lambda: invoice.full_clean())
Exemple #2
0
    def test_status_invoice(self):
        invoice = MyCharInvoide()
        invoice.number = 1234
        invoice.full_clean()
        invoice.save()

        self.assertEqual(invoice.status, 'NW')
Exemple #3
0
    def test_create_invoice(self):
        invoice = MyCharInvoide()
        invoice.number = 1234
        invoice.full_clean()
        invoice.save()

        self.assertTrue(MyCharInvoide.objects.count())