Example #1
0
 def test_update_line_items_one_cp_no_data(self):
     cp = create_cp_1382_12()
     cp.save()
     request = self.factory.get('report')
     request.session = {}
     cp_nbr = '1382'
     fy = '12'
     qtr = '1'
     response = report(request, cp_nbr, fy, qtr)
     self.assertEquals(200, response.status_code)
     cp = ControlPoint.objects.get(slug='1382-12')
     self.assertEquals(52, cp.line_items.count())
Example #2
0
    def test_report_one_cp_with_allocations(self):
        cp = create_cp_1382_12()
        cp.save()
        create_cp_1382_12_items_partial()

        request = self.factory.get('report')
        request.session = {}
        cp_nbr = '1382'
        fy = '12'
        qtr = '1'
        response = report(request, cp_nbr, fy, qtr)
        self.assertEquals(200, response.status_code)
        cp = ControlPoint.objects.get(slug='1382-12')
        self.assertEquals(52, cp.line_items.count())
        self.assertEquals(9, ProjectAccountLineItem.objects.count())
        allocs = ProjectAccountLineItem.objects.all()
        alloc = allocs.get(id=1)
        self.assertEquals('95958457', alloc.ien)
        self.assertEquals('1210011', alloc.fyqseq)
        self.assertEquals('O', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-10-03', str(alloc.date))
        self.assertEquals(Decimal('186.67'), alloc.amount)
        self.assertEquals(1, alloc.account_id)
        self.assertEquals(4, alloc.control_point_line_item_id)

        alloc = allocs.get(id=2)
        self.assertEquals('95958457', alloc.ien)
        self.assertEquals('1210011', alloc.fyqseq)
        self.assertEquals('O', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-10-03', str(alloc.date))
        self.assertEquals(Decimal('186.67'), alloc.amount)
        self.assertEquals(2, alloc.account_id)
        self.assertEquals(4, alloc.control_point_line_item_id)

        alloc = allocs.get(id=3)
        self.assertEquals('95958457', alloc.ien)
        self.assertEquals('1210011', alloc.fyqseq)
        self.assertEquals('O', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-10-03', str(alloc.date))
        self.assertEquals(Decimal('186.66'), alloc.amount)
        self.assertEquals(3, alloc.account_id)
        self.assertEquals(4, alloc.control_point_line_item_id)

        alloc = allocs.get(id=4)
        self.assertEquals('95876936', alloc.ien)
        self.assertEquals('1210029', alloc.fyqseq)
        self.assertEquals('A', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-10-31', str(alloc.date))
        self.assertEquals(Decimal('-13.33'), alloc.amount)
        self.assertEquals(1, alloc.account_id)
        self.assertEquals(27, alloc.control_point_line_item_id)

        alloc = allocs.get(id=5)
        self.assertEquals('95876936', alloc.ien)
        self.assertEquals('1210029', alloc.fyqseq)
        self.assertEquals('A', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-10-31', str(alloc.date))
        self.assertEquals(Decimal('-13.33'), alloc.amount)
        self.assertEquals(2, alloc.account_id)
        self.assertEquals(27, alloc.control_point_line_item_id)

        alloc = allocs.get(id=6)
        self.assertEquals('95876936', alloc.ien)
        self.assertEquals('1210029', alloc.fyqseq)
        self.assertEquals('A', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-10-31', str(alloc.date))
        self.assertEquals(Decimal('-13.34'), alloc.amount)
        self.assertEquals(3, alloc.account_id)
        self.assertEquals(27, alloc.control_point_line_item_id)

        alloc = allocs.get(id=7)
        self.assertEquals('95873815', alloc.ien)
        self.assertEquals('1210033', alloc.fyqseq)
        self.assertEquals('A', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-11-25', str(alloc.date))
        self.assertEquals(Decimal('-80'), alloc.amount)
        self.assertEquals(1, alloc.account_id)
        self.assertEquals(31, alloc.control_point_line_item_id)

        alloc = allocs.get(id=8)
        self.assertEquals('95873815', alloc.ien)
        self.assertEquals('1210033', alloc.fyqseq)
        self.assertEquals('A', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-11-25', str(alloc.date))
        self.assertEquals(Decimal('-80'), alloc.amount)
        self.assertEquals(2, alloc.account_id)
        self.assertEquals(31, alloc.control_point_line_item_id)

        alloc = allocs.get(id=9)
        self.assertEquals('95873815', alloc.ien)
        self.assertEquals('1210033', alloc.fyqseq)
        self.assertEquals('A', alloc.type)
        self.assertEquals('D25011', alloc.po_nbr)
        self.assertEquals('2011-11-25', str(alloc.date))
        self.assertEquals(Decimal('-80'), alloc.amount)
        self.assertEquals(3, alloc.account_id)
        self.assertEquals(31, alloc.control_point_line_item_id)