Esempio n. 1
0
def run_billing(request):
    page_message = None
    run_billing_form = RunBillingForm(initial={'run_billing': True})
    if request.method == 'POST':
        run_billing_form = RunBillingForm(request.POST)
        if run_billing_form.is_valid():
            billing.run_billing()
            page_message = 'At your request, I have run <a href="%s">the bills</a>.' % (reverse('staff.views.bills', args=[], kwargs={}),)
    logs = BillingLog.objects.all()[:10]
    return render_to_response('staff/run_billing.html', {'run_billing_form': run_billing_form, 'page_message': page_message, "billing_logs": logs}, context_instance=RequestContext(request))
Esempio n. 2
0
def run_billing(request):
    page_message = None
    run_billing_form = RunBillingForm(initial={'run_billing': True})
    if request.method == 'POST':
        run_billing_form = RunBillingForm(request.POST)
        if run_billing_form.is_valid():
            billing.run_billing()
            page_message = 'At your request, I have run <a href="%s">the bills</a>.' % (reverse('staff.views.billing.bills', args=[], kwargs={}),)
    logs = BillingLog.objects.all()[:10]
    return render_to_response('staff/run_billing.html', {'run_billing_form': run_billing_form, 'page_message': page_message, "billing_logs": logs}, context_instance=RequestContext(request))
Esempio n. 3
0
	def testRun(self):
		member1 = self.user1.get_profile()
		member2 = self.user2.get_profile()
		member3 = self.user3.get_profile()
		member4 = self.user4.get_profile()

		end_time = datetime(2010, 7, 1)
		day_range = range(40)
		day_range.reverse()
		days = [end_time - timedelta(days=i) for i in day_range]
		# 2010-05-31 through 2010-07-01
		for day in days:
			#print 'Testing: %s' % (day)
			billing.run_billing(day)
			if day.month == 6 and day.day == 10:
				self.assertTrue(member4.last_bill() != None)
				self.assertTrue(member4.last_bill().created.month == day.month)
				self.assertTrue(member4.last_bill().created.day == day.day)
				self.assertEqual(member4.last_bill().membership, Membership.objects.get(member=member4, membership_plan=self.pt5Plan.id))
				self.assertEqual(member4.last_bill().dropins.count(), 9) # dropins on 6/2 - 6/10
				self.assertEqual(member4.last_bill().amount, (member4.last_bill().dropins.count() - 5) * self.pt5Plan.daily_rate)
			if day.month == 6 and day.day == 11:
				self.assertTrue(member4.last_bill() != None)
				self.assertTrue(member4.last_bill().created.month == day.month and member4.last_bill().created.day == day.day)
				self.assertEqual(member4.last_bill().membership, Membership.objects.get(member=member4, membership_plan=self.residentPlan.id))
				self.assertEqual(member4.last_bill().dropins.count(), 0)
			if day.month == 6 and day.day == 20:
				self.assertTrue(member3.last_bill() != None)
				self.assertTrue(member3.last_bill().created.month == day.month and member3.last_bill().created.day == day.day)
				self.assertEqual(member3.last_bill().dropins.count(), 17)
			if day.month == 6 and day.day == 21:
				self.assertTrue(member3.last_bill() != None)
				self.assertTrue(member3.last_bill().created.month == day.month and member3.last_bill().created.day == day.day)
				self.assertEqual(member3.last_bill().dropins.count(), 0)
			if day.day == 26:
				self.assertTrue(member1.last_membership().is_anniversary_day(day))
				member_bills = member1.bills.all().order_by('-created')
				self.assertTrue(len(member_bills) > 0)
				self.assertTrue(member_bills[0].membership == member1.last_membership())
			if day.month == 6 and day.day == 30:
				self.assertTrue(member2.last_membership().is_anniversary_day(day))
Esempio n. 4
0
	def test_run(self):
		member1 = self.user1.get_profile()
		member2 = self.user2.get_profile()
		member3 = self.user3.get_profile()
		member4 = self.user4.get_profile()
		member5 = self.user5.get_profile()
		member6 = self.user6.get_profile()
		member7 = self.user7.get_profile()
		member8 = self.user8.get_profile()

		end_time = datetime(2010, 6, 30)
		day_range = range(30)
		day_range.reverse()
		days = [end_time - timedelta(days=i) for i in day_range]
		# 2010-06-1 through 2010-06-30
		for day in days:
			#print 'Testing: %s' % (day)
			billing.run_billing(day)
			if day.day == 10:
				# User4's PT5 membership
				self.assertTrue(member4.last_bill() != None)
				self.assertEqual(member4.last_bill().membership.membership_plan, self.pt5Plan)
				self.assertTrue(member4.last_bill().created.month == day.month and member4.last_bill().created.day == day.day)
				self.assertEqual(member4.last_bill().membership, Membership.objects.get(member=member4, membership_plan=self.pt5Plan.id))
				self.assertEqual(member4.last_bill().dropins.count(), 9) # dropins on 6/2 - 6/10
				self.assertEqual(member4.last_bill().amount, (member4.last_bill().dropins.count() - self.pt5Plan.dropin_allowance) * self.pt5Plan.daily_rate)
			if day.day == 11:
				# User4's Resident membership
				self.assertTrue(member4.last_bill() != None)
				self.assertEqual(member4.last_bill().membership.membership_plan, self.residentPlan)
				self.assertTrue(member4.last_bill().created.month == day.month and member4.last_bill().created.day == day.day)
				self.assertEqual(member4.last_bill().dropins.count(), 0)
			if day.day == 16:
				# User 5's PT15
				# Should be 15 dropins but they were part of the PT15 plan so no extra charges should be on this bill
				self.assertTrue(member5.last_bill() != None)
				self.assertEqual(member5.last_bill().membership.membership_plan, self.pt15Plan)
				self.assertTrue(member5.last_bill().created.month == day.month and member5.last_bill().created.day == day.day)
				self.assertEqual(member5.last_bill().membership, Membership.objects.get(member=member5, membership_plan=self.pt15Plan.id))
				#TODOself.assertEqual(member5.last_bill().dropins.count(), 15)
				self.assertEquals(member5.last_bill().amount, 0)
			if day.day == 17:
				# User 5's Basic membership
				self.assertTrue(member5.last_bill() != None)
				self.assertEqual(member5.last_bill().membership, Membership.objects.get(member=member5, membership_plan=self.basicPlan.id))
				self.assertEqual(member5.last_bill().dropins.count(), 0)
				self.assertEquals(member5.last_bill().amount, self.basicPlan.monthly_rate)
#			if day.day == 19:
#				# User 8's PT-5 membership (5 days)
#				self.assertTrue(member8.last_bill() != None)
#				self.assertEqual(member8.last_bill().membership.membership_plan, self.pt5Plan)
#				self.assertEqual(member8.last_bill().dropins.count(), 5)
#				self.assertEquals(member8.last_bill().amount, 0)
#				True
			if day.day == 20:
				# User 3's PT-15 membership
				self.assertTrue(member3.last_bill() != None)
				self.assertTrue(member3.last_bill().created.month == day.month and member3.last_bill().created.day == day.day)
				self.assertEqual(member3.last_bill().dropins.count(), 17)
				
				# User 8's Basic membership (4 days)
#				self.assertTrue(member8.last_bill() != None)
#				self.assertEqual(member8.last_bill().membership.membership_plan, self.basicPlan)
#				self.assertEqual(member8.last_bill().dropins.count(), 4)
			if day.day == 21:
				self.assertTrue(member3.last_bill() != None)
				self.assertTrue(member3.last_bill().created.month == day.month and member3.last_bill().created.day == day.day)
				self.assertEqual(member3.last_bill().dropins.count(), 0)
			if day.day == 26:
				# User 1
				self.assertTrue(member1.last_membership().is_anniversary_day(day))
				member_bills = member1.bills.all().order_by('-created')
				self.assertTrue(len(member_bills) > 0)
				self.assertTrue(member_bills[0].membership == member1.last_membership())
				
				# User 6's PT-5, User 7's PT-5
				# User 7 guest of user 6 and used 15 days
				self.assertEqual(member7.is_guest(), member6)
				self.assertTrue(member7.last_bill() != None)
				self.assertEqual(member7.last_bill().dropins.count(), 0)
				self.assertEquals(member7.last_bill().amount, 0)
				self.assertTrue(member6.last_bill() != None)
				self.assertEqual(member6.last_bill().dropins.count(), 0)
				self.assertEqual(member6.last_bill().guest_dropins.count(), 15)
				# $75 base rate + 10 overage days @ $20 = $275
				self.assertEquals(member6.last_bill().amount, 275)
			if day.day == 30:
				self.assertTrue(member2.last_membership().is_anniversary_day(day))
Esempio n. 5
0
def billing_task():
    """A recurring task which calculates billing"""
    billing.run_billing()
Esempio n. 6
0
def billing_task():
    """A recurring task which calculates billing"""
    billing.run_billing()
Esempio n. 7
0
 def handle_noargs(self, **options):
     billing.run_billing()
Esempio n. 8
0
    def test_run(self):
        member3 = self.user3.profile
        member4 = self.user4.profile
        member5 = self.user5.profile
        member6 = self.user6.profile
        member7 = self.user7.profile

        end_time = datetime(2010, 6, 30)
        day_range = range(30)
        day_range.reverse()
        days = [end_time - timedelta(days=i) for i in day_range]
        # 2010-06-1 through 2010-06-30
        for day in days:
            billing.run_billing(day)
            if day.day == 10:
                # User4's PT5 membership
                self.assertTrue(member4.last_bill() != None, "Member4 should have had a bill")
                self.assertEqual(member4.last_bill().membership.membership_plan, self.pt5Plan)
                self.assertTrue(member4.last_bill().bill_date.month == day.month and member4.last_bill().bill_date.day == day.day)
                self.assertEqual(member4.last_bill().membership, Membership.objects.get(user=self.user4, membership_plan=self.pt5Plan.id))
                self.assertEqual(member4.last_bill().dropins.count(), 9)  # dropins on 6/2 - 6/10
                self.assertEqual(member4.last_bill().amount, (member4.last_bill().dropins.count() - self.pt5Plan.dropin_allowance) * self.pt5Plan.daily_rate)
            if day.day == 11:
                # User4's Resident membership
                self.assertTrue(member4.last_bill() != None)
                self.assertEqual(member4.last_bill().membership.membership_plan, self.residentPlan)
                self.assertTrue(member4.last_bill().bill_date.month == day.month and member4.last_bill().bill_date.day == day.day)
                self.assertEqual(member4.last_bill().dropins.count(), 0)
            if day.day == 16:
                # User 5's PT15
                # Should be 15 dropins but they were part of the PT15 plan so no extra charges should be on this bill
                self.assertTrue(member5.last_bill() != None)
                self.assertEqual(member5.last_bill().membership.membership_plan, self.pt15Plan)
                self.assertTrue(member5.last_bill().bill_date.month == day.month and member5.last_bill().bill_date.day == day.day)
                self.assertEqual(member5.last_bill().membership, Membership.objects.get(user=self.user5, membership_plan=self.pt15Plan.id))
                #TODOself.assertEqual(member5.last_bill().dropins.count(), 15)
                self.assertEqual(member5.last_bill().amount, 0)
            if day.day == 17:
                # User 5's Basic membership
                self.assertTrue(member5.last_bill() != None)
                self.assertEqual(member5.last_bill().membership, Membership.objects.get(user=self.user5, membership_plan=self.basicPlan.id))
                self.assertEqual(member5.last_bill().dropins.count(), 0)
                self.assertEqual(member5.last_bill().amount, self.basicPlan.monthly_rate)
            if day.day == 20:
                # User 3's PT-15 membership
                self.assertTrue(member3.last_bill() != None)
                self.assertTrue(member3.last_bill().bill_date.month == day.month and member3.last_bill().bill_date.day == day.day)
                self.assertEqual(member3.last_bill().dropins.count(), 17)
            if day.day == 21:
                self.assertTrue(member3.last_bill() != None)
                self.assertTrue(member3.last_bill().bill_date.month == day.month and member3.last_bill().bill_date.day == day.day)
                self.assertEqual(member3.last_bill().dropins.count(), 0)
            if day.day == 26:
                # User 6's PT-5, User 7's PT-5
                # User 7 guest of user 6 and used 15 days
                self.assertEqual(member7.is_guest(), self.user6)
                self.assertTrue(member7.last_bill() != None)
                self.assertEqual(member7.last_bill().dropins.count(), 0)
                self.assertEqual(member7.last_bill().amount, 0)
                self.assertTrue(member6.last_bill() != None)
                self.assertEqual(member6.last_bill().dropins.count(), 0)
                self.assertEqual(member6.last_bill().guest_dropins.count(), 15)
                # $75 base rate + 10 overage days @ $20 = $275
                self.assertEqual(member6.last_bill().amount, 275)
Esempio n. 9
0
def run_billing_for_range(end_time, days):
    day_range = range(days)
    day_range.reverse()
    for i in day_range:
        day = end_time - timedelta(days=i)
        billing.run_billing(day)
Esempio n. 10
0
 def handle_noargs(self, **options):
     billing.run_billing()
Esempio n. 11
0
	def test_run(self):
		member3 = self.user3.get_profile()
		member4 = self.user4.get_profile()
		member5 = self.user5.get_profile()
		member6 = self.user6.get_profile()
		member7 = self.user7.get_profile()

		end_time = datetime(2010, 6, 30)
		day_range = range(30)
		day_range.reverse()
		days = [end_time - timedelta(days=i) for i in day_range]
		# 2010-06-1 through 2010-06-30
		for day in days:
			#print 'Testing: %s' % (day)
			billing.run_billing(day)
			if day.day == 10:
				# User4's PT5 membership
				self.assertTrue(member4.last_bill() != None, "Member4 should have had a bill")
				self.assertEqual(member4.last_bill().membership.membership_plan, self.pt5Plan)
				self.assertTrue(member4.last_bill().bill_date.month == day.month and member4.last_bill().bill_date.day == day.day)
				self.assertEqual(member4.last_bill().membership, Membership.objects.get(member=member4, membership_plan=self.pt5Plan.id))
				self.assertEqual(member4.last_bill().dropins.count(), 9) # dropins on 6/2 - 6/10
				self.assertEqual(member4.last_bill().amount, (member4.last_bill().dropins.count() - self.pt5Plan.dropin_allowance) * self.pt5Plan.daily_rate)
			if day.day == 11:
				# User4's Resident membership
				self.assertTrue(member4.last_bill() != None)
				self.assertEqual(member4.last_bill().membership.membership_plan, self.residentPlan)
				self.assertTrue(member4.last_bill().bill_date.month == day.month and member4.last_bill().bill_date.day == day.day)
				self.assertEqual(member4.last_bill().dropins.count(), 0)
			if day.day == 16:
				# User 5's PT15
				# Should be 15 dropins but they were part of the PT15 plan so no extra charges should be on this bill
				self.assertTrue(member5.last_bill() != None)
				self.assertEqual(member5.last_bill().membership.membership_plan, self.pt15Plan)
				self.assertTrue(member5.last_bill().bill_date.month == day.month and member5.last_bill().bill_date.day == day.day)
				self.assertEqual(member5.last_bill().membership, Membership.objects.get(member=member5, membership_plan=self.pt15Plan.id))
				#TODOself.assertEqual(member5.last_bill().dropins.count(), 15)
				self.assertEquals(member5.last_bill().amount, 0)
			if day.day == 17:
				# User 5's Basic membership
				self.assertTrue(member5.last_bill() != None)
				self.assertEqual(member5.last_bill().membership, Membership.objects.get(member=member5, membership_plan=self.basicPlan.id))
				self.assertEqual(member5.last_bill().dropins.count(), 0)
				self.assertEquals(member5.last_bill().amount, self.basicPlan.monthly_rate)
			if day.day == 20:
				# User 3's PT-15 membership
				self.assertTrue(member3.last_bill() != None)
				self.assertTrue(member3.last_bill().bill_date.month == day.month and member3.last_bill().bill_date.day == day.day)
				self.assertEqual(member3.last_bill().dropins.count(), 17)
			if day.day == 21:
				self.assertTrue(member3.last_bill() != None)
				self.assertTrue(member3.last_bill().bill_date.month == day.month and member3.last_bill().bill_date.day == day.day)
				self.assertEqual(member3.last_bill().dropins.count(), 0)
			if day.day == 26:
				# User 6's PT-5, User 7's PT-5
				# User 7 guest of user 6 and used 15 days
				self.assertEqual(member7.is_guest(), member6)
				self.assertTrue(member7.last_bill() != None)
				self.assertEqual(member7.last_bill().dropins.count(), 0)
				self.assertEquals(member7.last_bill().amount, 0)
				self.assertTrue(member6.last_bill() != None)
				self.assertEqual(member6.last_bill().dropins.count(), 0)
				self.assertEqual(member6.last_bill().guest_dropins.count(), 15)
				# $75 base rate + 10 overage days @ $20 = $275
				self.assertEquals(member6.last_bill().amount, 275)
Esempio n. 12
0
def run_billing_for_range(end_time, days):
	day_range = range(days)
	day_range.reverse()
	for i in day_range:
		day = end_time - timedelta(days=i)
		billing.run_billing(day)
Esempio n. 13
0
    def testRun(self):
        member1 = self.user1.get_profile()
        member2 = self.user2.get_profile()
        member3 = self.user3.get_profile()
        member4 = self.user4.get_profile()
        member5 = self.user5.get_profile()

        end_time = datetime(2010, 6, 30)
        day_range = range(30)
        day_range.reverse()
        days = [end_time - timedelta(days=i) for i in day_range]
        # 2010-06-1 through 2010-06-30
        for day in days:
            # print 'Testing: %s' % (day)
            billing.run_billing(day)
            if day.day == 1:
                # User5's PT15 membership
                self.assertTrue(member5.last_bill() != None)
                self.assertEqual(
                    member5.last_bill().membership,
                    Membership.objects.get(member=member5, membership_plan=self.pt15Plan.id),
                )
                self.assertEquals(member5.last_bill().amount, self.pt15Plan.monthly_rate)
                self.assertEquals(member5.last_bill().amount, self.pt15Plan.monthly_rate)
            if day.day == 10:
                # User4's PT5 membership
                self.assertTrue(member4.last_bill() != None)
                self.assertTrue(
                    member4.last_bill().created.month == day.month and member4.last_bill().created.day == day.day
                )
                self.assertEqual(
                    member4.last_bill().membership,
                    Membership.objects.get(member=member4, membership_plan=self.pt5Plan.id),
                )
                self.assertEqual(member4.last_bill().dropins.count(), 9)  # dropins on 6/2 - 6/10
                self.assertEqual(
                    member4.last_bill().amount,
                    (member4.last_bill().dropins.count() - self.pt5Plan.dropin_allowance) * self.pt5Plan.daily_rate,
                )
            if day.day == 11:
                self.assertTrue(member4.last_bill() != None)
                self.assertTrue(
                    member4.last_bill().created.month == day.month and member4.last_bill().created.day == day.day
                )
                self.assertEqual(
                    member4.last_bill().membership,
                    Membership.objects.get(member=member4, membership_plan=self.residentPlan.id),
                )
                self.assertEqual(member4.last_bill().dropins.count(), 0)
            if day.day == 16:
                # User 5's PT15
                # Should be 15 dropins but they were part of the PT15 plan so no extra charges should be on this bill
                self.assertTrue(member5.last_bill() != None)
                self.assertTrue(
                    member5.last_bill().created.month == day.month and member5.last_bill().created.day == day.day
                )
                self.assertEqual(
                    member5.last_bill().membership,
                    Membership.objects.get(member=member5, membership_plan=self.pt15Plan.id),
                )
                self.assertEqual(member5.last_bill().dropins.count(), 15)
                self.assertEquals(member5.last_bill().amount, 0)
            if day.day == 17:
                # User 5's Basic membership
                self.assertTrue(member5.last_bill() != None)
                self.assertEqual(
                    member5.last_bill().membership,
                    Membership.objects.get(member=member5, membership_plan=self.basicPlan.id),
                )
                self.assertEqual(member5.last_bill().dropins.count(), 0)
                self.assertEquals(member5.last_bill().amount, self.basicPlan.monthly_rate)
            if day.day == 20:
                self.assertTrue(member3.last_bill() != None)
                self.assertTrue(
                    member3.last_bill().created.month == day.month and member3.last_bill().created.day == day.day
                )
                self.assertEqual(member3.last_bill().dropins.count(), 17)
            if day.day == 21:
                self.assertTrue(member3.last_bill() != None)
                self.assertTrue(
                    member3.last_bill().created.month == day.month and member3.last_bill().created.day == day.day
                )
                self.assertEqual(member3.last_bill().dropins.count(), 0)
            if day.day == 26:
                self.assertTrue(member1.last_membership().is_anniversary_day(day))
                member_bills = member1.bills.all().order_by("-created")
                self.assertTrue(len(member_bills) > 0)
                self.assertTrue(member_bills[0].membership == member1.last_membership())
            if day.day == 30:
                self.assertTrue(member2.last_membership().is_anniversary_day(day))
Esempio n. 14
0
	def testRun(self):
		member1 = self.user1.get_profile()
		member2 = self.user2.get_profile()
		member3 = self.user3.get_profile()
		member4 = self.user4.get_profile()
		member5 = self.user5.get_profile()
		member6 = self.user6.get_profile()
		member7 = self.user7.get_profile()
		member8 = self.user8.get_profile()

		end_time = datetime(2010, 6, 30)
		day_range = range(30)
		day_range.reverse()
		days = [end_time - timedelta(days=i) for i in day_range]
		# 2010-06-1 through 2010-06-30
		for day in days:
			#print 'Testing: %s' % (day)
			billing.run_billing(day)
			if day.day == 10:
				# User4's PT5 membership
				self.assertTrue(member4.last_bill() != None)
				self.assertEqual(member4.last_bill().membership.membership_plan, self.pt5Plan)
				self.assertTrue(member4.last_bill().created.month == day.month and member4.last_bill().created.day == day.day)
				self.assertEqual(member4.last_bill().membership, Membership.objects.get(member=member4, membership_plan=self.pt5Plan.id))
				self.assertEqual(member4.last_bill().dropins.count(), 9) # dropins on 6/2 - 6/10
				self.assertEqual(member4.last_bill().amount, (member4.last_bill().dropins.count() - self.pt5Plan.dropin_allowance) * self.pt5Plan.daily_rate)
			if day.day == 11:
				# User4's Resident membership
				self.assertTrue(member4.last_bill() != None)
				self.assertEqual(member4.last_bill().membership.membership_plan, self.residentPlan)
				self.assertTrue(member4.last_bill().created.month == day.month and member4.last_bill().created.day == day.day)
				self.assertEqual(member4.last_bill().dropins.count(), 0)
			if day.day == 16:
				# User 5's PT15
				# Should be 15 dropins but they were part of the PT15 plan so no extra charges should be on this bill
				self.assertTrue(member5.last_bill() != None)
				self.assertEqual(member5.last_bill().membership.membership_plan, self.pt15Plan)
				self.assertTrue(member5.last_bill().created.month == day.month and member5.last_bill().created.day == day.day)
				self.assertEqual(member5.last_bill().membership, Membership.objects.get(member=member5, membership_plan=self.pt15Plan.id))
				#TODOself.assertEqual(member5.last_bill().dropins.count(), 15)
				self.assertEquals(member5.last_bill().amount, 0)
			if day.day == 17:
				# User 5's Basic membership
				self.assertTrue(member5.last_bill() != None)
				self.assertEqual(member5.last_bill().membership, Membership.objects.get(member=member5, membership_plan=self.basicPlan.id))
				self.assertEqual(member5.last_bill().dropins.count(), 0)
				self.assertEquals(member5.last_bill().amount, self.basicPlan.monthly_rate)
#			if day.day == 19:
#				# User 8's PT-5 membership (5 days)
#				self.assertTrue(member8.last_bill() != None)
#				self.assertEqual(member8.last_bill().membership.membership_plan, self.pt5Plan)
#				self.assertEqual(member8.last_bill().dropins.count(), 5)
#				self.assertEquals(member8.last_bill().amount, 0)
#				True
			if day.day == 20:
				# User 3's PT-15 membership
				self.assertTrue(member3.last_bill() != None)
				self.assertTrue(member3.last_bill().created.month == day.month and member3.last_bill().created.day == day.day)
				self.assertEqual(member3.last_bill().dropins.count(), 17)
				
				# User 8's Basic membership (4 days)
#				self.assertTrue(member8.last_bill() != None)
#				self.assertEqual(member8.last_bill().membership.membership_plan, self.basicPlan)
#				self.assertEqual(member8.last_bill().dropins.count(), 4)
			if day.day == 21:
				self.assertTrue(member3.last_bill() != None)
				self.assertTrue(member3.last_bill().created.month == day.month and member3.last_bill().created.day == day.day)
				self.assertEqual(member3.last_bill().dropins.count(), 0)
			if day.day == 26:
				# User 1
				self.assertTrue(member1.last_membership().is_anniversary_day(day))
				member_bills = member1.bills.all().order_by('-created')
				self.assertTrue(len(member_bills) > 0)
				self.assertTrue(member_bills[0].membership == member1.last_membership())
				
				# User 6's PT-5, User 7's PT-5
				# User 7 guest of user 6 and used 15 days
				self.assertEqual(member7.is_guest(), member6)
				self.assertTrue(member7.last_bill() != None)
				self.assertEqual(member7.last_bill().dropins.count(), 0)
				self.assertEquals(member7.last_bill().amount, 0)
				self.assertTrue(member6.last_bill() != None)
				self.assertEqual(member6.last_bill().dropins.count(), 0)
				self.assertEqual(member6.last_bill().guest_dropins.count(), 15)
				# $75 base rate + 10 overage days @ $20 = $275
				self.assertEquals(member6.last_bill().amount, 275)
			if day.day == 30:
				self.assertTrue(member2.last_membership().is_anniversary_day(day))
Esempio n. 15
0
 def handle(self, **options):
     billing.run_billing()
Esempio n. 16
0
 def handle(self, **options):
     billing.run_billing()