Fix fake missing membership tests

This commit is contained in:
Tanner Collin 2020-01-20 00:46:07 +00:00
parent 45965b29b2
commit e92182724b
3 changed files with 10 additions and 10 deletions

View File

@ -195,33 +195,33 @@ class TestFakeMonths(TestCase):
testing_member.current_start_date = datetime.date(2018, 6, 6)
testing_member.expire_date = datetime.date(2018, 7, 6)
tx = utils.fake_missing_membership_months(testing_member)
tx, count = utils.fake_missing_membership_months(testing_member)
self.assertEqual(tx.number_of_membership_months, 1)
self.assertEqual(count, 1)
def test_fake_missing_membership_months_one_and_half_month(self):
testing_member.current_start_date = datetime.date(2018, 6, 1)
testing_member.expire_date = datetime.date(2018, 7, 15)
tx = utils.fake_missing_membership_months(testing_member)
tx, count = utils.fake_missing_membership_months(testing_member)
self.assertEqual(tx.number_of_membership_months, 1)
self.assertEqual(count, 1)
def test_fake_missing_membership_months_one_year(self):
testing_member.current_start_date = datetime.date(2018, 6, 6)
testing_member.expire_date = datetime.date(2019, 6, 6)
tx = utils.fake_missing_membership_months(testing_member)
tx, count = utils.fake_missing_membership_months(testing_member)
self.assertEqual(tx.number_of_membership_months, 12)
self.assertEqual(count, 12)
def test_fake_missing_membership_months_same_month(self):
testing_member.current_start_date = datetime.date(2018, 6, 6)
testing_member.expire_date = datetime.date(2018, 6, 16)
tx = utils.fake_missing_membership_months(testing_member)
tx, count = utils.fake_missing_membership_months(testing_member)
self.assertEqual(tx.number_of_membership_months, 0)
self.assertEqual(count, 0)
class TestTallyMembership(TestCase):

View File

@ -77,7 +77,7 @@ def fake_missing_membership_months(member):
date=add_months(start_date, i),
)
return tx
return tx, missing_months
def tally_membership_months(member, fake_date=None):
'''

View File

@ -141,7 +141,7 @@ for m in members:
if not m.current_start_date: continue
import_date = datetime.date(2020, 1, 3)
tx = utils.fake_missing_membership_months(m)
tx, _ = utils.fake_missing_membership_months(m)
utils.tally_membership_months(m, import_date)
if tx: