def test_get_plant_day_hours_per_unit_first_shift_0_hours_per_unit(self):
        now = timezone.make_aware(dt.datetime(2016, 6, 2, 7, 30))
        settings = PlantSetting.objects.latest("timestamp")
        hours_per_unit_dict = tc.shift_1_hours_per_unit_dict_with_plant_0_hours_per_unit

        expected_hours_per_unit = 0
        expected_working_hours = 0
        expected_claims = 0

        self.assertEqual(
            get_plant_day_hours_per_unit(hours_per_unit_dict, now),
            (expected_hours_per_unit, expected_working_hours, expected_claims),
        )
    def test_get_plant_day_hours_per_unit_second_shift_no_first_shift_api_entry(self):
        now = timezone.make_aware(dt.datetime(2016, 6, 2, 15, 30))
        settings = PlantSetting.objects.latest("timestamp")
        hours_per_unit_dict = tc.shift_2_hours_per_unit_dict_with_plant

        expected_hours_per_unit = 90
        expected_working_hours = 90
        expected_claims = 1

        self.assertEqual(
            get_plant_day_hours_per_unit(hours_per_unit_dict, now),
            (expected_hours_per_unit, expected_working_hours, expected_claims),
        )
    def test_get_plant_day_hours_per_unit_second_shift_0_claims(self):
        now = timezone.make_aware(dt.datetime(2016, 6, 2, 15, 30))
        settings = PlantSetting.objects.latest("timestamp")
        hours_per_unit_dict = tc.shift_2_hours_per_unit_dict_with_plant_0_hours_per_unit
        hours_per_unitATM.objects.create(**api_tc.two_shifts_first_shift_api_entry_0_claims)

        expected_hours_per_unit = 0
        expected_working_hours = 720
        expected_claims = 0

        self.assertEqual(
            get_plant_day_hours_per_unit(hours_per_unit_dict, now),
            (expected_hours_per_unit, expected_working_hours, expected_claims),
        )
    def test_get_plant_day_hours_per_unit_first_shift(self):
        now = timezone.make_aware(dt.datetime(2016, 6, 2, 7, 30))
        settings = PlantSetting.objects.latest("timestamp")
        hours_per_unit_dict = tc.shift_1_hours_per_unit_dict_with_plant
        hours_per_unitATM.objects.create(**api_tc.three_shifts_third_shift_api_entry)

        expected_hours_per_unit = 90
        expected_working_hours = 810
        expected_claims = 9

        self.assertEqual(
            get_plant_day_hours_per_unit(hours_per_unit_dict, now),
            (expected_hours_per_unit, expected_working_hours, expected_claims),
        )