Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ietf/doc/tests_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def test_search_mail_archive(self):
messages = r.json()["messages"]
self.assertEqual(len(messages), 2)

today = date_today()
today = date_today(datetime.timezone.utc)

self.assertEqual(messages[0]["url"], "https://www.example.com/testmessage")
self.assertTrue("John Doe" in messages[0]["content"])
Expand Down
8 changes: 4 additions & 4 deletions ietf/doc/tests_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from unittest.mock import patch

from django.db import IntegrityError
from django.utils import timezone

from ietf.group.factories import GroupFactory, RoleFactory
from ietf.name.models import DocTagName
Expand All @@ -16,7 +17,6 @@
from ietf.doc.utils import (update_action_holders, add_state_change_event, update_documentauthors,
fuzzy_find_documents, rebuild_reference_relations)
from ietf.utils.draft import Draft, PlaintextDraft
from ietf.utils.timezone import date_today
from ietf.utils.xmldraft import XMLDraft


Expand Down Expand Up @@ -147,10 +147,10 @@ def test_update_action_holders_resets_age(self):
dah.time_added = datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc) # arbitrary date in the past
dah.save()

today = date_today()
self.assertNotEqual(doc.documentactionholder_set.get(person=self.ad).time_added.date(), today)
right_now = timezone.now()
self.assertLess(doc.documentactionholder_set.get(person=self.ad).time_added, right_now)
self.update_doc_state(doc, State.objects.get(slug='ad-eval'))
self.assertEqual(doc.documentactionholder_set.get(person=self.ad).time_added.date(), today)
self.assertGreaterEqual(doc.documentactionholder_set.get(person=self.ad).time_added, right_now)

def test_update_action_holders_add_tag_need_rev(self):
"""Adding need-rev tag adds authors as action holders"""
Expand Down
6 changes: 5 additions & 1 deletion ietf/ipr/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from pyquery import PyQuery
from urllib.parse import quote, urlparse
from zoneinfo import ZoneInfo

from django.conf import settings
from django.urls import reverse as urlreverse
Expand Down Expand Up @@ -595,7 +596,10 @@ def test_notify_generic(self):
r = self.client.post(url, data )
self.assertEqual(r.status_code,302)
self.assertEqual(len(outbox),2)
self.assertIn('Secretariat on '+ipr.get_latest_event_submitted().time.strftime("%Y-%m-%d"), get_payload_text(outbox[1]).replace('\n',' '))
self.assertIn(
'Secretariat on ' + ipr.get_latest_event_submitted().time.astimezone(ZoneInfo(settings.TIME_ZONE)).strftime("%Y-%m-%d"),
get_payload_text(outbox[1]).replace('\n',' '),
)
self.assertIn(f'{settings.IDTRACKER_BASE_URL}{urlreverse("ietf.ipr.views.showlist")}', get_payload_text(outbox[1]).replace('\n',' '))

def send_ipr_email_helper(self):
Expand Down
8 changes: 4 additions & 4 deletions ietf/liaisons/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def test_add_incoming_liaison(self):
from_groups = [ str(g.pk) for g in Group.objects.filter(type="sdo") ]
to_group = Group.objects.get(acronym="mars")
submitter = Person.objects.get(user__username="marschairman")
today = date_today()
today = date_today(datetime.timezone.utc)
related_liaison = liaison
r = self.client.post(url,
dict(from_groups=from_groups,
Expand Down Expand Up @@ -779,7 +779,7 @@ def test_add_outgoing_liaison(self):
from_group = Group.objects.get(acronym="mars")
to_group = Group.objects.filter(type="sdo")[0]
submitter = Person.objects.get(user__username="marschairman")
today = date_today()
today = date_today(datetime.timezone.utc)
related_liaison = liaison
r = self.client.post(url,
dict(from_groups=str(from_group.pk),
Expand Down Expand Up @@ -847,7 +847,7 @@ def test_add_outgoing_liaison_unapproved_post_only(self):
from_group = Group.objects.get(acronym="mars")
to_group = Group.objects.filter(type="sdo")[0]
submitter = Person.objects.get(user__username="marschairman")
today = date_today()
today = date_today(datetime.timezone.utc)
r = self.client.post(url,
dict(from_groups=str(from_group.pk),
from_contact=submitter.email_address(),
Expand All @@ -866,7 +866,7 @@ def test_add_outgoing_liaison_unapproved_post_only(self):
self.assertEqual(len(outbox), mailbox_before + 1)

def test_liaison_add_attachment(self):
liaison = LiaisonStatementFactory(deadline=date_today()+datetime.timedelta(days=1))
liaison = LiaisonStatementFactory(deadline=date_today(DEADLINE_TZINFO)+datetime.timedelta(days=1))
LiaisonStatementEventFactory(statement=liaison,type_id='submitted')

self.assertEqual(liaison.attachments.count(),0)
Expand Down
16 changes: 10 additions & 6 deletions ietf/nomcom/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pyquery import PyQuery
from urllib.parse import urlparse
from itertools import combinations
from zoneinfo import ZoneInfo

from django.db import IntegrityError
from django.db.models import Max
Expand Down Expand Up @@ -1506,11 +1507,12 @@ def test_help(self):
def test_accept_reject_nomination_edges(self):
self.client.logout()
np = self.nc.nominee_set.order_by('pk').first().nomineeposition_set.order_by('pk').first()
date_str = np.time.astimezone(ZoneInfo(settings.TIME_ZONE)).strftime("%Y%m%d")
kwargs={'year':self.nc.year(),
'nominee_position_id':np.id,
'state':'accepted',
'date':np.time.strftime("%Y%m%d"),
'hash':get_hash_nominee_position(np.time.strftime("%Y%m%d"),np.id),
'date':date_str,
'hash':get_hash_nominee_position(date_str, np.id),
}
url = reverse('ietf.nomcom.views.process_nomination_status', kwargs=kwargs)
response = self.client.get(url)
Expand All @@ -1520,8 +1522,9 @@ def test_accept_reject_nomination_edges(self):
settings.DAYS_TO_EXPIRE_NOMINATION_LINK = 2
np.time = np.time - datetime.timedelta(days=3)
np.save()
kwargs['date'] = np.time.strftime("%Y%m%d")
kwargs['hash'] = get_hash_nominee_position(np.time.strftime("%Y%m%d"),np.id)
date_str = np.time.astimezone(ZoneInfo(settings.TIME_ZONE)).strftime("%Y%m%d")
kwargs['date'] = date_str
kwargs['hash'] = get_hash_nominee_position(date_str, np.id)
url = reverse('ietf.nomcom.views.process_nomination_status', kwargs=kwargs)
response = self.client.get(url)
self.assertEqual(response.status_code,403)
Expand All @@ -1535,12 +1538,13 @@ def test_accept_reject_nomination_edges(self):

def test_accept_reject_nomination_comment(self):
np = self.nc.nominee_set.order_by('pk').first().nomineeposition_set.order_by('pk').first()
hash = get_hash_nominee_position(np.time.strftime("%Y%m%d"),np.id)
date_str = np.time.astimezone(ZoneInfo(settings.TIME_ZONE)).strftime("%Y%m%d")
hash = get_hash_nominee_position(date_str, np.id)
url = reverse('ietf.nomcom.views.process_nomination_status',
kwargs={'year':self.nc.year(),
'nominee_position_id':np.id,
'state':'accepted',
'date':np.time.strftime("%Y%m%d"),
'date':date_str,
'hash':hash,
}
)
Expand Down