コード例 #1
0
ファイル: tests.py プロジェクト: bartaelterman/BIA-payment
 def setUp(self):
     school = School(name='testschool')
     school.save()
     # country = Country(name='testcountry')
     # country.save()
     child = Child(first_name='mary', surname='jones', sex='f', school=school)
     child.save()
     contributor1 = Contributor(first_name='john', surname='doe', aard_van_de_schenker='np', street='some street',
                                street_number=4, zip_code=2010, city='city', payment_frequency='every month',
                                language='nl')
     contributor1.save()
     contributor2 = Contributor(first_name='marie', surname='evers', aard_van_de_schenker='np', street='some street',
                                street_number=4, zip_code=2010, city='city', payment_frequency='every 3 months',
                                language='nl')
     contributor2.save()
     contributor3 = Contributor(first_name='havent', surname='peeyd', aard_van_de_schenker='np', street='some street',
                                street_number=4, zip_code=2010, city='city', payment_frequency='every 3 months',
                                language='nl')
     contributor3.save()
     payments = [
         {'amount': 42.4, 'contributor': contributor1, 'child': child, 'date': date(2014, 2, 20), 'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 42.4, 'contributor': contributor1, 'child': child, 'date': date(2014, 3, 20), 'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 42.4, 'contributor': contributor1, 'child': child, 'date': date(2014, 1, 20), 'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 42.4, 'contributor': contributor2, 'child': child, 'date': date(2014, 1, 14), 'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 42.4, 'contributor': contributor2, 'child': child, 'date': date(2014, 4, 15), 'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 42.4, 'contributor': contributor2, 'child': child, 'date': date(2014, 7, 16), 'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 42.4, 'contributor': contributor2, 'child': child, 'date': date(2014, 10, 17), 'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 42.4, 'contributor': contributor3, 'child': child, 'date': date(2014, 10, 17), 'entitled': 'entitled', 'ptype': 'recurrent'},
     ]
     for p in payments:
         payment = Payment(**p)
         payment.save()
コード例 #2
0
ファイル: tests.py プロジェクト: bartaelterman/BIA-payment
 def setUp(self):
     """
     This fixture data set includes:
         contributor1: pays every month and therefor, should not be included in reminders report, although his next
          expected payment is in the near future.
         contributor2: pays every 3 months, and hence should show up in the overdue report.
         contributor3: pays every year and hence should show up in the reminders report.
         contributor4: pays sporadic, and hence should not be included in one of the reports
     """
     print 'installing fixture data'
     self.reference_date = date(2015, 11, 7)
     country = Country(name='Belgium', code=150)
     country.save()
     school = School(name='testschool')
     school.save()
     child = Child(first_name='mary', surname='jones', sex='f', school=school)
     child.save()
     self.contributor1 = Contributor(first_name='john', surname='doe', aard_van_de_schenker='np', street='some street',
                                street_number=4, zip_code=2010, city='city', country=country,
                                payment_frequency='every month', language='nl')
     self.contributor1.save()
     self.contributor2 = Contributor(first_name='marie', surname='evers', aard_van_de_schenker='np',
                                     street='some street', street_number=4, zip_code=2010, city='city',
                                     country=country, payment_frequency='every 3 months', language='nl')
     self.contributor2.save()
     self.contributor3 = Contributor(first_name='harvey', surname='jones', aard_van_de_schenker='np',
                                     street='some street', street_number=4, zip_code=2010, city='city',
                                     country=country, payment_frequency='every year', language='nl')
     self.contributor3.save()
     self.contributor4 = Contributor(first_name='jeff', surname='buckley', aard_van_de_schenker='np',
                                     street='some street', street_number=4, zip_code=2010, city='city',
                                     country=country, payment_frequency='sporadic', language='nl')
     self.contributor4.save()
     payments = [
         {'amount': 45, 'contributor': self.contributor1, 'child': child, 'date': date(2015, 10, 1),
          'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 45, 'contributor': self.contributor1, 'child': child, 'date': date(2015, 12, 4),
          'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 45, 'contributor': self.contributor2, 'child': child, 'date': date(2015, 8, 15),
          'expected_date': date(2015, 8, 1), 'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 42.4, 'contributor': self.contributor3, 'child': child,
          'date': date(2014, 12, 10), 'expected_date': date(2014, 11, 21),
         'entitled': 'entitled', 'ptype': 'recurrent'},
         {'amount': 30, 'contributor': self.contributor4, 'child': child,
          'date': date(2014, 12, 1), 'entitled': 'entitled', 'ptype': 'recurrent'},
     ]
     for p in payments:
         payment = Payment(**p)
         payment.save()
コード例 #3
0
ファイル: tests.py プロジェクト: bartaelterman/BIA-payment
def create_fixture():
    country = Country(name='Belgium', code=150)
    country.save()
    school = School(name='testschool')
    school.save()
    child = Child(first_name='mary', surname='jones', sex='f', school=school)
    child.save()
    contributor = Contributor(first_name='john', surname='doe', aard_van_de_schenker='np', street='some street',
                               street_number=4, zip_code=2010, city='city', country=country,
                               payment_frequency='every month', language='nl')
    contributor.save()

    payments = [
        {'amount': 48, 'contributor': contributor, 'child': child, 'date': date(2015, 10, 1),
         'entitled': 'entitled', 'ptype': 'recurrent'},
        {'amount': 49, 'contributor': contributor, 'child': child, 'date': date(2015, 12, 4),
         'entitled': 'entitled', 'ptype': 'recurrent'},
        {'amount': 49.5, 'contributor': contributor, 'child': child, 'date': date(2015, 12, 16),
         'entitled': 'entitled', 'ptype': 'single'}
    ]
    for p in payments:
        payment = Payment(**p)
        payment.save()