コード例 #1
0
ファイル: tests_model.py プロジェクト: ioO/django-billjobs
 def test_create_bill(self):
     bill = Bill(user=self.user)
     bill.save()
     self.assertEqual(bill.user.username, self.user.username)
     self.assertEqual(bill.issuer_address, BILLJOBS_BILL_ISSUER)
     self.assertEqual(
             bill.billing_address, self.user.userprofile.billing_address)
コード例 #2
0
 def test_create_bill(self):
     bill = Bill(user=self.user)
     bill.save()
     self.assertEqual(bill.user.username, self.user.username)
     self.assertEqual(bill.issuer_address, BILLJOBS_BILL_ISSUER)
     self.assertEqual(bill.billing_address,
                      self.user.userprofile.billing_address)
コード例 #3
0
ファイル: tests_model.py プロジェクト: ioO/django-billjobs
 def test_bill_number_is_more_than_999(self):
     ''' Test the bill number property could be more than 999 '''
     for i in range(1100):
         bill = Bill(user=self.user)
         bill.save()
         del(bill)
     # get last bill
     last_bill = Bill.objects.order_by('id').last()
     # bills number depend on date, so depend when test is running ;)
     today = datetime.date.today()
     last_number = 'F%s%s' % (today.strftime('%Y%m'), '1100')
     self.assertEqual(last_bill.number, last_number)
コード例 #4
0
 def test_bill_number_is_more_than_999(self):
     ''' Test the bill number property could be more than 999 '''
     for i in range(1100):
         bill = Bill(user=self.user)
         bill.save()
         del (bill)
     # get last bill
     last_bill = Bill.objects.order_by('id').last()
     # bills number depend on date, so depend when test is running ;)
     today = datetime.date.today()
     last_number = 'F%s%s' % (today.strftime('%Y%m'), '1100')
     self.assertEqual(last_bill.number, last_number)
コード例 #5
0
 def test_user_change_billing_address(self):
     ''' Test when user is changing is billing address
         Previous bill is with old address
         New bill is with new address
     '''
     bill = Bill(user=self.user)
     previous_billing_address = self.user.userprofile.billing_address
     bill.save()
     # user change billing_address
     self.user.userprofile.billing_address = '1 new street\n34000 Town'
     self.user.save()
     new_billing_address = self.user.userprofile.billing_address
     # user create a new bill
     new_bill = Bill(user=self.user)
     new_bill.save()
     self.assertEqual(bill.billing_address, previous_billing_address)
     self.assertEqual(new_bill.billing_address, new_billing_address)
コード例 #6
0
 def test_save_bill_do_not_change_billing_address(self):
     ''' Test when user change his billing address and modify an old bill
         it doesn't change the billing address
     '''
     bill = Bill(user=self.user)
     previous_billing_address = self.user.userprofile.billing_address
     bill.save()
     # user change billing_address
     self.user.userprofile.billing_address = '1 new street\n34000 Town'
     self.user.save()
     # bill is changing
     bill.amount = 100
     bill.save()
     self.assertEqual(bill.billing_address, previous_billing_address)
コード例 #7
0
ファイル: tests_model.py プロジェクト: ioO/django-billjobs
 def test_save_bill_do_not_change_billing_address(self):
     ''' Test when user change his billing address and modify an old bill
         it doesn't change the billing address
     '''
     bill = Bill(user=self.user)
     previous_billing_address = self.user.userprofile.billing_address
     bill.save()
     # user change billing_address
     self.user.userprofile.billing_address = '1 new street\n34000 Town'
     self.user.save()
     # bill is changing
     bill.amount = 100
     bill.save()
     self.assertEqual(bill.billing_address, previous_billing_address)
コード例 #8
0
ファイル: tests_model.py プロジェクト: ioO/django-billjobs
 def test_user_change_billing_address(self):
     ''' Test when user is changing is billing address
         Previous bill is with old address
         New bill is with new address
     '''
     bill = Bill(user=self.user)
     previous_billing_address = self.user.userprofile.billing_address
     bill.save()
     # user change billing_address
     self.user.userprofile.billing_address = '1 new street\n34000 Town'
     self.user.save()
     new_billing_address = self.user.userprofile.billing_address
     # user create a new bill
     new_bill = Bill(user=self.user)
     new_bill.save()
     self.assertEqual(bill.billing_address, previous_billing_address)
     self.assertEqual(new_bill.billing_address, new_billing_address)