Settings assertion values in hours

This commit is contained in:
Sam Splunks 2024-04-09 13:45:41 +00:00
parent aa5e2d0c67
commit 62ef86a047

View File

@ -312,14 +312,14 @@ class TimeSpentAutoTestCase(TestCase):
response = self.client.post(reverse('helpdesk:update', kwargs={ response = self.client.post(reverse('helpdesk:update', kwargs={
'ticket_id': ticket.id}), post_data) 'ticket_id': ticket.id}), post_data)
latest_fup = ticket.followup_set.latest('id') latest_fup = ticket.followup_set.latest('id')
latest_fup.date = ticket.created + timedelta(minutes=60 * i) latest_fup.date = ticket.created + timedelta(hours=i)
latest_fup.time_spent = None latest_fup.time_spent = None
latest_fup.save() latest_fup.save()
# total ticket time for followups is 5 hours # total ticket time for followups is 5 hours
self.assertEqual(latest_fup.date - ticket.created, timedelta(hours=5)) self.assertEqual(latest_fup.date - ticket.created, timedelta(hours=5))
# calculated time spent with 2 hours exclusion is 3 hours # calculated time spent with 2 hours exclusion is 3 hours
self.assertEqual(ticket.time_spent.total_seconds(), 3 * 3600.0) self.assertEqual(ticket.time_spent.total_seconds(), timedelta(hours=3).total_seconds())
# remove queues exclusion # remove queues exclusion
helpdesk_settings.FOLLOWUP_TIME_SPENT_EXCLUDE_QUEUES = () helpdesk_settings.FOLLOWUP_TIME_SPENT_EXCLUDE_QUEUES = ()