Example #1
0
    def test_import_data(self):
        no_cycle_q = Q(billingcycle=None)

        with open("../membership/fixtures/csv-test.txt", 'r') as f:
            process_csv(f)
        payment_count = Payment.objects.filter(~no_cycle_q).count()
        error = "The payment in the sample file should have matched"
        self.assertEqual(payment_count, 1, error)
        payment = Payment.objects.filter(billingcycle=self.cycle).latest("payment_day")
        cycle = BillingCycle.objects.get(pk=self.cycle.pk)
        self.assertEqual(cycle.reference_number, payment.reference_number)
        self.assertTrue(cycle.is_paid)
Example #2
0
    def test_import_data(self):
        no_cycle_q = Q(billingcycle=None)

        with open("../membership/fixtures/csv-test.txt", 'r') as f:
            process_csv(f)
        payment_count = Payment.objects.filter(~no_cycle_q).count()
        error = "The payment in the sample file should have matched"
        self.assertEqual(payment_count, 1, error)
        payment = Payment.objects.filter(
            billingcycle=self.cycle).latest("payment_day")
        cycle = BillingCycle.objects.get(pk=self.cycle.pk)
        self.assertEqual(cycle.reference_number, payment.reference_number)
        self.assertTrue(cycle.is_paid)
Example #3
0
    def test_file_reading(self):
        "csvbills: test data should have 3 payments, none of which match"
        with open("../membership/fixtures/csv-test.txt", 'r') as f:
            process_csv(f)

        payment_count = Payment.objects.count()
        error = "There should be 3 non-negative payments in the testdata"
        self.assertEqual(payment_count, 3, error)

        no_cycle_q = Q(billingcycle=None)
        nomatch_payments = Payment.objects.filter(~no_cycle_q).count()
        error = "No payments should match without any members in db"
        self.assertEqual(nomatch_payments, 0, error)
Example #4
0
    def test_file_reading(self):
        "csvbills: test data should have 3 payments, none of which match"
        with open("../membership/fixtures/csv-test.txt", 'r') as f:
            process_csv(f)

        payment_count = Payment.objects.count()
        error = "There should be 3 non-negative payments in the testdata"
        self.assertEqual(payment_count, 3, error)

        no_cycle_q = Q(billingcycle=None)
        nomatch_payments = Payment.objects.filter(~no_cycle_q).count()
        error = "No payments should match without any members in db"
        self.assertEqual(nomatch_payments, 0, error)