def test_invoice_attribute_is_working_properly(self): """testing if the invoice attribute value can be correctly changed """ from stalker import Payment, Invoice p = Payment(invoice=self.test_invoice, amount=1499, unit='TRY') new_invoice = Invoice(budget=self.test_budget, client=self.test_client, amount=2500, unit='TRY') self.assertNotEqual(p.invoice, new_invoice) p.invoice = new_invoice self.assertEqual(p.invoice, new_invoice)
def test_invoice_attribute_is_None(self): """testing if a TypeError will be raised when the invoice attribute is set to None """ from stalker import Payment p = Payment(invoice=self.test_invoice, amount=1499, unit='TRY') with pytest.raises(TypeError) as cm: p.invoice = None assert str(cm.value) == \ 'Payment.invoice should be an Invoice instance, not NoneType'
def test_invoice_attribute_is_None(self): """testing if a TypeError will be raised when the invoice attribute is set to None """ from stalker import Payment p = Payment(invoice=self.test_invoice, amount=1499, unit='TRY') with self.assertRaises(TypeError) as cm: p.invoice = None self.assertEqual( str(cm.exception), 'Payment.invoice should be an Invoice instance, not NoneType')
def test_invoice_attribute_is_set_to_a_value_other_than_an_invoice_instance( self): """testing if a TypeError will be raised when the invoice attribute is set to a value other than an Invoice instance """ from stalker import Payment p = Payment(invoice=self.test_invoice, amount=1499, unit='TRY') with pytest.raises(TypeError) as cm: p.invoice = 'not an invoice instance' assert str(cm.value) == \ 'Payment.invoice should be an Invoice instance, not str'
def test_invoice_argument_is_working_properly(self): """testing if the invoice argument value is correctly passed to the invoice attribute """ from stalker import Payment p = Payment(invoice=self.test_invoice, amount=1499, unit='TRY') self.assertEqual(p.invoice, self.test_invoice)
def test_invoice_argument_is_skipped(self): """testing if a TypeError will be raised when the invoice argument is skipped """ from stalker import Payment with pytest.raises(TypeError) as cm: p = Payment(amount=1499, unit='TRY') assert str(cm.value) == \ 'Payment.invoice should be an Invoice instance, not NoneType'
def test_invoice_argument_is_skipped(self): """testing if a TypeError will be raised when the invoice argument is skipped """ from stalker import Payment with self.assertRaises(TypeError) as cm: p = Payment(amount=1499, unit='TRY') self.assertEqual( str(cm.exception), 'Payment.invoice should be an Invoice instance, not NoneType')
def test_invoice_argument_is_not_an_invoice_instance(self): """testing if a TypeError will be raised when the invoice argument is not an Invoice instance """ from stalker import Payment with pytest.raises(TypeError) as cm: p = Payment(invoice='not an invoice instance', amount=1499, unit='TRY') assert str(cm.value) == \ 'Payment.invoice should be an Invoice instance, not str'
def test_invoice_argument_is_not_an_invoice_instance(self): """testing if a TypeError will be raised when the invoice argument is not an Invoice instance """ from stalker import Payment with self.assertRaises(TypeError) as cm: p = Payment(invoice='not an invoice instance', amount=1499, unit='TRY') self.assertEqual( str(cm.exception), 'Payment.invoice should be an Invoice instance, not str')
def test_creating_a_payment_instance(self): """testing if it is possible to create a Payment instance """ from stalker import Payment payment = Payment(invoice=self.test_invoice, amount=1000, unit='TRY') self.assertIsInstance(payment, Payment)