Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
a6eb0ac8
Verified
Commit
a6eb0ac8
authored
Feb 12, 2020
by
Sébastiaan Versteeg
Browse files
Add base class for all payable objects
parent
6a48da16
Changes
2
Hide whitespace changes
Inline
Side-by-side
website/payments/models.py
View file @
a6eb0ac8
...
...
@@ -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
...
...
website/payments/tests/test_models.py
View file @
a6eb0ac8
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment