def test_last_membership_year_method(self): john = Member.objects.get(last_name='Lennon') # get John self.assertEqual(john.last_membership_year(), Meeting.get_current_meeting_year()) # Test John's recent membership self.assertNotEqual(john.last_membership_year(), 2014) paul = Member.objects.get(last_name='Mcartney') self.assertEqual(paul.last_membership_year(), 2014) george = Member.objects.get(last_name='Harrison') self.assertEqual(george.last_membership_year(), 'None') ringo = Member.objects.get(last_name='Star') self.assertEqual(ringo.last_membership_year(), 'None')
def setUp(self): john = Member.objects.create(last_name="Lennon", first_name="John", member=True, registered=True) paul = Member.objects.create(last_name="Mcartney", first_name="Paul", member=True, registered=False) george = Member.objects.create(last_name="Harrison", first_name="George", member=False, registered=True) ringo = Member.objects.create(last_name="Star", first_name="Ringo", member=False, registered=False) buggsy = Member.objects.create(last_name='Bugglesworth', first_name='Paul', member=True, registered=False) cy = Meeting.get_current_meeting_year() Membership.objects.create(member=john, year=2014, payment_type='M') # John is a member in 2014 Membership.objects.create(member=john, year=2015, payment_type='M') # John is a member in 2015 Membership.objects.create(member=john, year=cy, payment_type='M') # John is a current member Membership.objects.create(member=john, year=2015, payment_type='R') # John registered for meetings in 2015 Membership.objects.create(member=paul, year=2014, payment_type='M') # Paul is a member in 2014 # Paul is not registered for 2015 meeting # George is not a member in 2015 Membership.objects.create(member=george, year=2015, payment_type='R') # George registered for meetings in 2015
def is_currently_registered(self): if self.last_registration_year() == Meeting.get_current_meeting_year(): return True else: return False
def get_current_membership_year(self): return Meeting.get_current_meeting_year()
def is_current_member(self): if self.last_membership_year() == Meeting.get_current_meeting_year(): return True else: return False