Verified Commit a6eb0ac8 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Add base class for all payable objects

parent 6a48da16
......@@ -11,6 +11,24 @@ from localflavor.generic.countries.sepa import IBAN_SEPA_COUNTRIES
from localflavor.generic.models import IBANField, BICField
class Payable:
@property
def payment_amount(self):
raise NotImplementedError
@property
def payment_topic(self):
raise NotImplementedError
@property
def payment_notes(self):
raise NotImplementedError
@property
def payment_payer(self):
raise NotImplementedError
class Payment(models.Model):
"""
Describes a payment
......
......@@ -4,7 +4,31 @@ from django.utils import timezone
from freezegun import freeze_time
from members.models import Member
from payments.models import Payment, BankAccount
from payments.models import Payment, BankAccount, Payable
class PayableTest(TestCase):
"""Tests for the Payable class"""
def test_payment_amount_not_implemented(self):
p = Payable()
with self.assertRaises(NotImplementedError):
_ = p.payment_amount
def test_payment_topic_not_implemented(self):
p = Payable()
with self.assertRaises(NotImplementedError):
_ = p.payment_topic
def test_payment_notes_not_implemented(self):
p = Payable()
with self.assertRaises(NotImplementedError):
_ = p.payment_notes
def test_payment_payer_not_implemented(self):
p = Payable()
with self.assertRaises(NotImplementedError):
_ = p.payment_payer
@override_settings(SUSPEND_SIGNALS=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment