From 210b7b13f852e88d195d0086e61fdb06876de965 Mon Sep 17 00:00:00 2001 From: Sam Splunks <72095718+samsplunks@users.noreply.github.com> Date: Mon, 8 Apr 2024 08:31:58 +0000 Subject: [PATCH 1/4] Removing unused test Client --- helpdesk/tests/test_time_spent_auto.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/helpdesk/tests/test_time_spent_auto.py b/helpdesk/tests/test_time_spent_auto.py index d40d2800..79c00ea9 100644 --- a/helpdesk/tests/test_time_spent_auto.py +++ b/helpdesk/tests/test_time_spent_auto.py @@ -3,7 +3,6 @@ from datetime import datetime, timedelta from django.contrib.auth.hashers import make_password from django.contrib.auth.models import User from django.test import TestCase, override_settings -from django.test.client import Client from helpdesk.models import FollowUp, Queue, Ticket from helpdesk import settings as helpdesk_settings import uuid @@ -25,8 +24,6 @@ class TimeSpentAutoTestCase(TestCase): title='test ticket', description='test ticket description') - self.client = Client() - self.user = User.objects.create( username='staff', email='staff@example.com', From 09f504fa3effe10abf97f1bfa23d524fec52b4aa Mon Sep 17 00:00:00 2001 From: Sam Splunks <72095718+samsplunks@users.noreply.github.com> Date: Mon, 8 Apr 2024 08:37:00 +0000 Subject: [PATCH 2/4] Removing unnecessary followup saves --- helpdesk/tests/test_time_spent_auto.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/helpdesk/tests/test_time_spent_auto.py b/helpdesk/tests/test_time_spent_auto.py index 79c00ea9..63847c4e 100644 --- a/helpdesk/tests/test_time_spent_auto.py +++ b/helpdesk/tests/test_time_spent_auto.py @@ -37,6 +37,7 @@ class TimeSpentAutoTestCase(TestCase): """Tests automatic time_spent calculation.""" # activate automatic calculation helpdesk_settings.FOLLOWUP_TIME_SPENT_AUTO = True + helpdesk_settings.USE_TZ = True # ticket creation date, follow-up creation date, assertion value TEST_VALUES = ( @@ -69,7 +70,6 @@ class TimeSpentAutoTestCase(TestCase): message_id=uuid.uuid4().hex, time_spent=None ) - followup1.save() self.assertEqual(followup1.time_spent.total_seconds(), assertion_delta.total_seconds()) self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds()) @@ -88,7 +88,6 @@ class TimeSpentAutoTestCase(TestCase): message_id=uuid.uuid4().hex, time_spent=None ) - followup2.save() self.assertEqual(followup2.time_spent.total_seconds(), delta.total_seconds()) self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds() + delta.total_seconds()) @@ -172,7 +171,6 @@ class TimeSpentAutoTestCase(TestCase): message_id=uuid.uuid4().hex, time_spent=None ) - followup1.save() self.assertEqual(followup1.time_spent.total_seconds(), assertion_delta.total_seconds()) self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds()) @@ -210,7 +208,6 @@ class TimeSpentAutoTestCase(TestCase): message_id=uuid.uuid4().hex, time_spent=None ) - followup1.save() # The Follow-up time_spent should be zero as the default OPEN_STATUS was excluded from calculation self.assertEqual(followup1.time_spent.total_seconds(), 0.0) @@ -249,7 +246,6 @@ class TimeSpentAutoTestCase(TestCase): message_id=uuid.uuid4().hex, time_spent=None ) - followup1.save() # The Follow-up time_spent should be zero as the default queue was excluded from calculation self.assertEqual(followup1.time_spent.total_seconds(), 0.0) From 27bafa847c8201b381d141ea3d8c3f278c42c933 Mon Sep 17 00:00:00 2001 From: Sam Splunks <72095718+samsplunks@users.noreply.github.com> Date: Mon, 8 Apr 2024 08:39:27 +0000 Subject: [PATCH 3/4] Removed old comment --- helpdesk/lib.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/helpdesk/lib.py b/helpdesk/lib.py index 96bb430f..83f5b1a8 100644 --- a/helpdesk/lib.py +++ b/helpdesk/lib.py @@ -234,8 +234,6 @@ def daily_time_spent_calculation(earliest, latest, open_hours): latest = latest.replace(hour=end_hour, minute=end_minute, second=end_second) day_delta = latest - earliest - - # returns up to 86399 seconds, add one second if full day time_spent_seconds += day_delta.seconds return time_spent_seconds \ No newline at end of file From e439acd626ce2263cffe0f0475733633d9c492f7 Mon Sep 17 00:00:00 2001 From: Sam Splunks <72095718+samsplunks@users.noreply.github.com> Date: Mon, 8 Apr 2024 08:41:27 +0000 Subject: [PATCH 4/4] Removed helpdesk_settings USE_TZ --- helpdesk/tests/test_time_spent_auto.py | 1 - 1 file changed, 1 deletion(-) diff --git a/helpdesk/tests/test_time_spent_auto.py b/helpdesk/tests/test_time_spent_auto.py index 63847c4e..2cdaab91 100644 --- a/helpdesk/tests/test_time_spent_auto.py +++ b/helpdesk/tests/test_time_spent_auto.py @@ -37,7 +37,6 @@ class TimeSpentAutoTestCase(TestCase): """Tests automatic time_spent calculation.""" # activate automatic calculation helpdesk_settings.FOLLOWUP_TIME_SPENT_AUTO = True - helpdesk_settings.USE_TZ = True # ticket creation date, follow-up creation date, assertion value TEST_VALUES = (