mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-12 12:46:53 +02:00
Adding USE_TZ = True to comply with 32bits tests
This commit is contained in:
parent
d6b37f1c11
commit
f0fb8039ef
@ -2,13 +2,14 @@
|
|||||||
from datetime import datetime, timedelta
|
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
|
from django.test import TestCase, override_settings
|
||||||
from django.test.client import Client
|
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
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(USE_TZ=True)
|
||||||
class TimeSpentAutoTestCase(TestCase):
|
class TimeSpentAutoTestCase(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -96,4 +97,21 @@ class TimeSpentAutoTestCase(TestCase):
|
|||||||
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())
|
||||||
|
|
||||||
# delete second follow-up as we test it with many intervals
|
# delete second follow-up as we test it with many intervals
|
||||||
followup2.delete()
|
followup2.delete()
|
||||||
|
|
||||||
|
|
||||||
|
def test_add_two_followups_time_spent_auto(self):
|
||||||
|
"""Tests automatic time_spent calculation"""
|
||||||
|
# activate automatic calculation
|
||||||
|
helpdesk_settings.FOLLOWUP_TIME_SPENT_AUTO = True
|
||||||
|
|
||||||
|
# ticket creation date, follow-up creation date, assertion value
|
||||||
|
TEST_VALUES = (
|
||||||
|
# friday
|
||||||
|
('2024-03-01T00:00:00+00:00', '2024-03-01T09:30:10+00:00', timedelta(hours=9, minutes=30, seconds=10)),
|
||||||
|
('2024-03-01T00:00:00+00:00', '2024-03-01T23:59:58+00:00', timedelta(hours=23, minutes=59, seconds=58)),
|
||||||
|
('2024-03-01T00:00:00+00:00', '2024-03-01T23:59:59+00:00', timedelta(hours=23, minutes=59, seconds=59)),
|
||||||
|
('2024-03-01T00:00:00+00:00', '2024-03-02T00:00:00+00:00', timedelta(hours=24)),
|
||||||
|
('2024-03-01T00:00:00+00:00', '2024-03-02T09:00:00+00:00', timedelta(hours=33)),
|
||||||
|
('2024-03-01T00:00:00+00:00', '2024-03-03T00:00:00+00:00', timedelta(hours=48)),
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user