Example #1
0
 def test_compare_expect_against_query(self):
     start = timezone.make_aware(dt.datetime(2016, 6, 3, 6, 30))
     expected_employees = ['001', '004', '006', '005', '010']
     employees = get_clocked_in(start)
     print(employees)
     self.assertTrue(
         compare_expect_against_query(expected_employees, employees))
    def test_emp_man_hours(self):
        """Test for employees who clocked in before start is accurate"""
        start = timezone.make_aware(dt.datetime(2016, 6, 3, 6, 30))
        stop = timezone.make_aware(dt.datetime(2016, 6, 3, 10, 30))
        emp_hours = 0

        expected_emp_hours = 20.95

        # getting employee objects that are clocked in
        clocked_in_emp = get_clocked_in(start)
        emp_that_left = get_emp_who_left_during_shift(start, stop)
        emp_that_breaked = get_emp_who_left_on_break(start, stop)

        # testing return of number of hours
        for employee in clocked_in_emp:
            print("EMP= ", employee.EMP_ID_TXT)
            emp_hour = get_emp_man_hours(employee, start, stop)
            print("EMP HOUR= ", emp_hour)
            emp_hours += emp_hour

        for employee in emp_that_left:
            print("EMP= ", employee.EMP_ID_TXT)
            emp_hour = get_emp_man_hours(employee, start, stop)
            print("EMP HOUR= ", emp_hour)
            emp_hours += emp_hour

        for employee in emp_that_breaked:
            print("EMP= ", employee.EMP_ID_TXT)
            emp_hour = get_emp_man_hours(employee, start, stop)
            print("EMP HOUR= ", emp_hour)
            emp_hours += emp_hour

        self.assertAlmostEqual(emp_hours, expected_emp_hours)
    def test_emp_man_hours(self):
        """Test for employees who clocked in before start is accurate"""
        start = timezone.make_aware(dt.datetime(2016, 6, 3, 6, 30))
        stop = timezone.make_aware(dt.datetime(2016, 6, 3, 10, 30))
        emp_hours = 0

        expected_emp_hours = 20.95

        # getting employee objects that are clocked in
        clocked_in_emp = get_clocked_in(start)
        emp_that_left = get_emp_who_left_during_shift(start, stop)
        emp_that_breaked = get_emp_who_left_on_break(start, stop)

        # testing return of number of hours
        for employee in clocked_in_emp:
            print("EMP= ", employee.EMP_ID_TXT)
            emp_hour = get_emp_man_hours(employee, start, stop)
            print("EMP HOUR= ", emp_hour)
            emp_hours += emp_hour

        for employee in emp_that_left:
            print("EMP= ", employee.EMP_ID_TXT)
            emp_hour = get_emp_man_hours(employee, start, stop)
            print("EMP HOUR= ", emp_hour)
            emp_hours += emp_hour

        for employee in emp_that_breaked:
            print("EMP= ", employee.EMP_ID_TXT)
            emp_hour = get_emp_man_hours(employee, start, stop)
            print("EMP HOUR= ", emp_hour)
            emp_hours += emp_hour

        self.assertAlmostEqual(emp_hours, expected_emp_hours)
    def test_create_single_list_from_list_of_queryset(self):
        start = timezone.make_aware(dt.datetime(2016, 6, 3, 6, 30))
        stop = timezone.make_aware(dt.datetime(2016, 6, 3, 9, 39))

        # can't call get_employees because that function uses create single list
        currently_clocked_in = get_clocked_in(start)
        emp_that_left = get_emp_who_left_during_shift(start, stop)
        emp_that_break = get_emp_who_left_on_break(start, stop)

        expected_employees = ['001', '004', '006', '005', '010']

        result_list = create_single_list_from_list_of_queryset(
            [currently_clocked_in, emp_that_break, emp_that_left])

        self.assertTrue(
            compare_expect_against_query(expected_employees, result_list))
    def test_create_single_list_from_list_of_queryset(self):
        start = timezone.make_aware(dt.datetime(2016, 6, 3, 6, 30))
        stop = timezone.make_aware(dt.datetime(2016, 6, 3, 9, 39))

        # can't call get_employees because that function uses create single list
        currently_clocked_in = get_clocked_in(start)
        emp_that_left = get_emp_who_left_during_shift(start, stop)
        emp_that_break = get_emp_who_left_on_break(start, stop)

        expected_employees = ['001', '004', '006', '005', '010']

        result_list = create_single_list_from_list_of_queryset([
            currently_clocked_in,
            emp_that_break,
            emp_that_left
        ])

        self.assertTrue(compare_expect_against_query(expected_employees, result_list))
    def test_get_clocked_in(self):
        """Test for employees who clocked in is accurate"""
        start = timezone.make_aware(dt.datetime(2016, 6, 3, 6, 30))
        expected_employees = ['001', '004', '006', '005', '010']
        neg_counter = len(expected_employees)

        # test that expected employees is what is found
        employees = get_clocked_in(start)
        for employee in employees:
            print(employee.EMP_ID_TXT)
            print(expected_employees)

            # testing that the length of expected goes to 0 and that we are not missing things
            self.assertEqual(len(expected_employees), neg_counter)
            neg_counter -= 1

            found_item, expected_employees = find_pop_and_return(
                looking_for=employee.EMP_ID_TXT,
                expected_list=expected_employees,
            )
            self.assertEqual(employee.EMP_ID_TXT, found_item)
    def test_get_clocked_in(self):
        """Test for employees who clocked in is accurate"""
        start = timezone.make_aware(dt.datetime(2016, 6, 3, 6, 30))
        expected_employees = ['001', '004', '006', '005', '010']
        neg_counter = len(expected_employees)

        # test that expected employees is what is found
        employees = get_clocked_in(start)
        for employee in employees:
            print(employee.EMP_ID_TXT)
            print(expected_employees)

            # testing that the length of expected goes to 0 and that we are not missing things
            self.assertEqual(len(expected_employees), neg_counter)
            neg_counter -= 1

            found_item, expected_employees = find_pop_and_return(
                looking_for=employee.EMP_ID_TXT,
                expected_list=expected_employees,
            )
            self.assertEqual(employee.EMP_ID_TXT, found_item)
 def test_compare_expect_against_query(self):
     start = timezone.make_aware(dt.datetime(2016, 6, 3, 6, 30))
     expected_employees = ['001', '004', '006', '005', '010']
     employees = get_clocked_in(start)
     print(employees)
     self.assertTrue(compare_expect_against_query(expected_employees, employees))