mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-25 01:13:31 +01:00
Merge pull request #1166 from samsplunks/main
test_time_spent_auto.py cleanup
This commit is contained in:
commit
c893d9b7d7
@ -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)
|
latest = latest.replace(hour=end_hour, minute=end_minute, second=end_second)
|
||||||
|
|
||||||
day_delta = latest - earliest
|
day_delta = latest - earliest
|
||||||
|
|
||||||
# returns up to 86399 seconds, add one second if full day
|
|
||||||
time_spent_seconds += day_delta.seconds
|
time_spent_seconds += day_delta.seconds
|
||||||
|
|
||||||
return time_spent_seconds
|
return time_spent_seconds
|
@ -3,7 +3,6 @@ from datetime import datetime, timedelta
|
|||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from django.test.client import Client
|
|
||||||
from helpdesk.models import FollowUp, Queue, Ticket
|
from helpdesk.models import FollowUp, Queue, Ticket
|
||||||
from helpdesk import settings as helpdesk_settings
|
from helpdesk import settings as helpdesk_settings
|
||||||
import uuid
|
import uuid
|
||||||
@ -25,8 +24,6 @@ class TimeSpentAutoTestCase(TestCase):
|
|||||||
title='test ticket',
|
title='test ticket',
|
||||||
description='test ticket description')
|
description='test ticket description')
|
||||||
|
|
||||||
self.client = Client()
|
|
||||||
|
|
||||||
self.user = User.objects.create(
|
self.user = User.objects.create(
|
||||||
username='staff',
|
username='staff',
|
||||||
email='staff@example.com',
|
email='staff@example.com',
|
||||||
@ -72,7 +69,6 @@ class TimeSpentAutoTestCase(TestCase):
|
|||||||
message_id=uuid.uuid4().hex,
|
message_id=uuid.uuid4().hex,
|
||||||
time_spent=None
|
time_spent=None
|
||||||
)
|
)
|
||||||
followup1.save()
|
|
||||||
|
|
||||||
self.assertEqual(followup1.time_spent.total_seconds(), assertion_delta.total_seconds())
|
self.assertEqual(followup1.time_spent.total_seconds(), assertion_delta.total_seconds())
|
||||||
self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds())
|
self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds())
|
||||||
@ -91,7 +87,6 @@ class TimeSpentAutoTestCase(TestCase):
|
|||||||
message_id=uuid.uuid4().hex,
|
message_id=uuid.uuid4().hex,
|
||||||
time_spent=None
|
time_spent=None
|
||||||
)
|
)
|
||||||
followup2.save()
|
|
||||||
|
|
||||||
self.assertEqual(followup2.time_spent.total_seconds(), delta.total_seconds())
|
self.assertEqual(followup2.time_spent.total_seconds(), delta.total_seconds())
|
||||||
self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds() + delta.total_seconds())
|
self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds() + delta.total_seconds())
|
||||||
@ -175,7 +170,6 @@ class TimeSpentAutoTestCase(TestCase):
|
|||||||
message_id=uuid.uuid4().hex,
|
message_id=uuid.uuid4().hex,
|
||||||
time_spent=None
|
time_spent=None
|
||||||
)
|
)
|
||||||
followup1.save()
|
|
||||||
|
|
||||||
self.assertEqual(followup1.time_spent.total_seconds(), assertion_delta.total_seconds())
|
self.assertEqual(followup1.time_spent.total_seconds(), assertion_delta.total_seconds())
|
||||||
self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds())
|
self.assertEqual(ticket.time_spent.total_seconds(), assertion_delta.total_seconds())
|
||||||
@ -213,7 +207,6 @@ class TimeSpentAutoTestCase(TestCase):
|
|||||||
message_id=uuid.uuid4().hex,
|
message_id=uuid.uuid4().hex,
|
||||||
time_spent=None
|
time_spent=None
|
||||||
)
|
)
|
||||||
followup1.save()
|
|
||||||
|
|
||||||
# The Follow-up time_spent should be zero as the default OPEN_STATUS was excluded from calculation
|
# 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)
|
self.assertEqual(followup1.time_spent.total_seconds(), 0.0)
|
||||||
@ -252,7 +245,6 @@ class TimeSpentAutoTestCase(TestCase):
|
|||||||
message_id=uuid.uuid4().hex,
|
message_id=uuid.uuid4().hex,
|
||||||
time_spent=None
|
time_spent=None
|
||||||
)
|
)
|
||||||
followup1.save()
|
|
||||||
|
|
||||||
# The Follow-up time_spent should be zero as the default queue was excluded from calculation
|
# 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)
|
self.assertEqual(followup1.time_spent.total_seconds(), 0.0)
|
||||||
|
Loading…
Reference in New Issue
Block a user