Skip to content

Commit 2c521c4

Browse files
committed
tests: add test for cancel, test for rollback to edit from cancel
1 parent df8fb54 commit 2c521c4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sponsors/tests/test_models.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def test_rollback_sponsorship_to_edit(self):
227227
Sponsorship.APPLIED,
228228
Sponsorship.APPROVED,
229229
Sponsorship.REJECTED,
230+
Sponsorship.CANCELLED,
230231
]
231232
for status in can_rollback_from:
232233
sponsorship.status = status
@@ -301,6 +302,16 @@ def test_display_agreed_fee_for_approved_and_finalized_status(self):
301302

302303
self.assertEqual(sponsorship.agreed_fee, 2000)
303304

305+
def test_cancel_sponsorship(self):
306+
sponsorship = Sponsorship.new(self.sponsor, self.benefits)
307+
sponsorship.status = Sponsorship.APPROVED
308+
sponsorship.save()
309+
310+
sponsorship.cancel()
311+
312+
self.assertEqual(sponsorship.status, Sponsorship.CANCELLED)
313+
self.assertIsNotNone(sponsorship.cancelled_on)
314+
304315

305316
class SponsorshipCurrentYearTests(TestCase):
306317

0 commit comments

Comments
 (0)