Skip to content

Commit f64bf95

Browse files
committed
Restored a test that was unintentionally removed. Removed unused templates. Related to ietf-tools#2513. Commit ready for merge.
- Legacy-Id: 15114
1 parent 7d2ac83 commit f64bf95

5 files changed

Lines changed: 14 additions & 102 deletions

File tree

ietf/secr/drafts/email.py

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import datetime
22
import glob
33
import os
4-
import time
54

65
from django.conf import settings
76
from django.template.loader import render_to_string
@@ -173,13 +172,11 @@ def get_fullcc_list(draft):
173172
def get_email_initial(draft, action=None, input=None):
174173
"""
175174
Takes a draft object, a string representing the email type:
176-
(extend,new,replace,resurrect,revision,update,withdraw) and
177-
a dictonary of the action form input data (for use with replace, update, extend).
175+
(extend,resurrect,revision,update,withdraw) and
176+
a dictonary of the action form input data (for use with update, extend).
178177
Returns a dictionary containing initial field values for a email notification.
179178
The dictionary consists of to, cc, subject, body.
180179
181-
NOTE: for type=new we are listing all authors in the message body to match legacy app.
182-
It appears datatracker abbreviates the list with "et al".
183180
"""
184181
expiration_date = (datetime.date.today() + datetime.timedelta(185)).strftime('%B %d, %Y')
185182
new_revision = str(int(draft.rev)+1).zfill(2)
@@ -196,33 +193,6 @@ def get_email_initial(draft, action=None, input=None):
196193
data['body'] = render_to_string('drafts/message_extend.txt', context)
197194
data['expiration_date'] = input['expiration_date']
198195

199-
elif action == 'new':
200-
# if the ID belongs to a group other than "none" add line to message body
201-
if draft.group.type.slug == 'wg':
202-
wg_message = 'This draft is a work item of the %s Working Group of the IETF.' % draft.group.name
203-
else:
204-
wg_message = ''
205-
context = {'wg_message':wg_message,
206-
'draft':draft,
207-
'authors':get_abbr_authors(draft),
208-
'revision_date':draft.latest_event(type='new_revision').time.date(),
209-
'timestamp':time.strftime("%Y-%m-%d%H%M%S", time.localtime())}
210-
data['to'] = 'i-d-announce@ietf.org'
211-
data['cc'] = draft.group.list_email
212-
data['subject'] = 'I-D Action: %s' % (curr_filename)
213-
data['body'] = render_to_string('drafts/message_new.txt', context)
214-
215-
elif action == 'replace':
216-
'''
217-
input['replaced'] is a DocAlias
218-
input['replaced_by'] is a Document
219-
'''
220-
context = {'doc':input['replaced'],'replaced_by':input['replaced_by']}
221-
data['subject'] = 'Replacement of %s with %s' % (input['replaced'],input['replaced_by'])
222-
data['body'] = render_to_string('drafts/message_replace.txt', context)
223-
data['replaced'] = input['replaced']
224-
data['replaced_by'] = input['replaced_by']
225-
226196
elif action == 'resurrect':
227197
last_revision = get_last_revision(draft.name)
228198
last_filename = draft.name + '-' + last_revision + '.txt'

ietf/secr/drafts/tests_views.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from ietf.doc.models import State, Document
1515
from ietf.meeting.factories import MeetingFactory
1616
from ietf.person.factories import PersonFactory
17+
from ietf.person.models import Person
18+
from ietf.submit.models import Preapproval
1719
from ietf.submit.tests import submission_file
1820
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
1921
from ietf.utils.test_data import make_test_data
@@ -72,6 +74,16 @@ def test_add(self):
7274
response = self.client.post(url,post)
7375
self.assertEqual(response.status_code, 302)
7476

77+
def test_approvals(self):
78+
make_test_data()
79+
Preapproval.objects.create(name='draft-dummy',
80+
by=Person.objects.get(name="(System)"))
81+
url = urlreverse('ietf.secr.drafts.views.approvals')
82+
self.client.login(username="secretary", password="secretary+password")
83+
response = self.client.get(url)
84+
self.assertEqual(response.status_code, 200)
85+
self.assertTrue('draft-dummy' in response.content)
86+
7587
def test_edit(self):
7688
draft = make_test_data()
7789
url = urlreverse('ietf.secr.drafts.views.edit', kwargs={'id':draft.name})

ietf/secr/templates/drafts/message_new.txt

Lines changed: 0 additions & 36 deletions
This file was deleted.

ietf/secr/templates/drafts/message_replace.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

ietf/secr/templates/drafts/replace.html

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)