Ejemplo n.º 1
0
    def test_ubuntu(self):
        from evista.constants import UBUNTU_VISTA
        vista = VistaSource()
        vista.site_id = UBUNTU_VISTA['ID']
        vista.hostname = '192.168.1.136'
        vista.port = UBUNTU_VISTA['PORT']
        vista.site_type = VistaSource.TEST
        vista.site_name = 'OSEHRA'

        employee = Employee()
        employee.fed_id = '123456789'
        employee.name = 'DEPARTMENT OF DEFENSE,USER'
        employee.uid = '33'

        self.user = RdtUser()
        self.user.vista_src = vista
        self.user.employee_rec = employee

        run = PayRun(fy=13, pay_period=15)
Ejemplo n.º 2
0
    def test_get_efforts_by_month(self):
        employee = Employee()
        employee.id = 1
        employee.project_id = 1
        employee.salary = 89752

        assignment = Assignment()
        assignment.start_date =  date(2013, 12, 1)
        assignment.end_date = date(2014, 4, 30)
        assignment.effort = 25
        assignment.project_id = 1
        assignment.role_id = 1
        employee.assignments.add(assignment)

        assignment = Assignment()
        assignment.start_date =  date(2014, 3, 1)
        assignment.end_date = date(2014, 6, 30)
        assignment.effort = 50
        assignment.project_id = 2
        assignment.role_id = 1
        employee.assignments.add(assignment)

        assignment = Assignment()
        assignment.start_date =  date(2014, 1, 1)
        assignment.end_date = date(2014, 3, 31)
        assignment.effort = 10
        assignment.project_id = 3
        assignment.role_id = 1
        employee.assignments.add(assignment)

        efforts = employee.get_efforts_by_month()
        self.assertEqual(7, len(efforts))
        self.assertEqual(EffortCost(25, to_money(1869.83)), efforts[EffortMonth(2013, 12)])
        self.assertEqual(EffortCost(35, to_money(2617.76)), efforts[EffortMonth(2014, 1)])
        self.assertEqual(EffortCost(35, to_money(2617.76)), efforts[EffortMonth(2014, 2)])
        self.assertEqual(EffortCost(85, to_money(6357.43)), efforts[EffortMonth(2014, 3)])
        self.assertEqual(EffortCost(75, to_money(5609.50)), efforts[EffortMonth(2014, 4)])
        self.assertEqual(EffortCost(50, to_money(3739.67)), efforts[EffortMonth(2014, 5)])
        self.assertEqual(EffortCost(50, to_money(3739.67)), efforts[EffortMonth(2014, 6)])
Ejemplo n.º 3
0
    def test_next_under(self):
        employee = Employee()
        employee.id = 1
        employee.salary = 89752
        employee.fte = Decimal(.83)

        assignment = Assignment()
        assignment.start_date = date(2013, 11, 1)
        assignment.end_date = date(2014, 4, 30)
        assignment.effort = 70
        assignment.project_id = 1
        assignment.role_id = 1
        employee.assignments.add(assignment)

        assignment = Assignment()
        assignment.start_date = date(2013, 11, 1)
        assignment.end_date = date(2014, 4, 30)
        assignment.effort = 13
        assignment.project_id = 2
        assignment.role_id = 1
        employee.assignments.add(assignment)

        actual = employee.next_under(start_date=date(2014, 1, 1))
        self.assertEqual((2014,5), actual)

        employee.assignments.all().delete()

        assignment = Assignment()
        assignment.start_date = date(2013, 11, 1)
        assignment.end_date = date(2014, 4, 30)
        assignment.effort = 70
        assignment.project_id = 1
        assignment.role_id = 1
        employee.assignments.add(assignment)

        assignment = Assignment()
        assignment.start_date = date(2013, 11, 1)
        assignment.end_date = date(2014, 3, 31)
        assignment.effort = 13
        assignment.project_id = 2
        assignment.role_id = 1
        employee.assignments.add(assignment)

        actual = employee.next_under(start_date=date(2014, 1, 1))
        self.assertEqual((2014,4), actual)
Ejemplo n.º 4
0
 def _load_employee(self, employee_flds, cp_nbr):
     try:
         employee = Employee.objects.get(uid=employee_flds[0])
     except Employee.DoesNotExist:
         from decimal import Decimal
         employee = Employee()
         employee.uid = employee_flds[0]
         employee.name = employee_flds[1]
         employee.fed_id = employee_flds[2]
         employee.grade = employee_flds[3]
         employee.step = employee_flds[4]
         employee.fte = employee_flds[5]
         employee.salary = employee_flds[6]
         employee.gross_pay = Decimal(employee_flds[7]) * 26
         employee.cp_nbr = cp_nbr
         employee.save()
     self.employee_id = employee.id
Ejemplo n.º 5
0
    def test_get_efforts(self):
        employee = Employee()
        employee.id = 1
        employee.project_id = 1

        prv1 = Assignment()
        prv1.start_date =  date(2014, 2, 1)
        prv1.end_date = date(2014, 4, 30)
        prv1.effort = 25
        prv1.project_id = 1
        prv1.role_id = 1
        employee.assignments.add(prv1)

        prv2 = Assignment()
        prv2.start_date =  date(2014, 3, 1)
        prv2.end_date = date(2014, 6, 30)
        prv2.effort = 50
        prv2.project_id = 2
        prv2.role_id = 1
        employee.assignments.add(prv2)

        new_assignment = Assignment()
        new_assignment.start_date = date(2014, 1,1)
        new_assignment.end_date = date(2014, 1, 31)
        new_assignment.effort = 10
        new_assignment.project_id = 3
        new_assignment.role_id = 1
        new_assignment.employee = employee

        efforts = new_assignment.get_efforts()
        self.assertEqual(1, len(efforts))
        self.assertEqual(10, efforts[(2014,1)])

        new_assignment.end_date = date(2014, 2, 28)
        efforts = new_assignment.get_efforts()
        self.assertEqual(2, len(efforts))
        self.assertEqual(10, efforts[(2014,1)])
        self.assertEqual(35, efforts[(2014,2)])

        new_assignment.end_date = date(2014, 3, 31)
        efforts = new_assignment.get_efforts()
        self.assertEqual(3, len(efforts))
        self.assertEqual(10, efforts[(2014,1)])
        self.assertEqual(35, efforts[(2014,2)])
        self.assertEqual(85, efforts[(2014,3)])

        new_assignment.end_date = date(2014, 4, 30)
        efforts = new_assignment.get_efforts()
        self.assertEqual(4, len(efforts))
        self.assertEqual(10, efforts[(2014,1)])
        self.assertEqual(35, efforts[(2014,2)])
        self.assertEqual(85, efforts[(2014,3)])
        self.assertEqual(85, efforts[(2014,4)])

        new_assignment.end_date = date(2014, 6, 30)
        efforts = new_assignment.get_efforts()
        self.assertEqual(6, len(efforts))
        self.assertEqual(10, efforts[(2014,1)])
        self.assertEqual(35, efforts[(2014,2)])
        self.assertEqual(85, efforts[(2014,3)])
        self.assertEqual(85, efforts[(2014,4)])
        self.assertEqual(60, efforts[(2014,5)])
        self.assertEqual(60, efforts[(2014,6)])

        new_assignment.end_date = date(2014, 7, 31)
        efforts = new_assignment.get_efforts()
        self.assertEqual(7, len(efforts))
        self.assertEqual(10, efforts[(2014,1)])
        self.assertEqual(35, efforts[(2014,2)])
        self.assertEqual(85, efforts[(2014,3)])
        self.assertEqual(85, efforts[(2014,4)])
        self.assertEqual(60, efforts[(2014,5)])
        self.assertEqual(60, efforts[(2014,6)])
        self.assertEqual(10, efforts[(2014,7)])

        new_assignment.start_date = date(2014, 2, 1)
        efforts = new_assignment.get_efforts()
        self.assertEqual(6, len(efforts))
        self.assertEqual(35, efforts[(2014,2)])
        self.assertEqual(85, efforts[(2014,3)])
        self.assertEqual(85, efforts[(2014,4)])
        self.assertEqual(60, efforts[(2014,5)])
        self.assertEqual(60, efforts[(2014,6)])
        self.assertEqual(10, efforts[(2014,7)])