Skip to content

Commit

Permalink
Restored a test that was unintentionally removed. Removed unused temp…
Browse files Browse the repository at this point in the history
…lates. Related to #2513. Commit ready for merge.

 - Legacy-Id: 15114
  • Loading branch information
rjsparks committed May 3, 2018
1 parent 7d2ac83 commit f64bf95
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 102 deletions.
34 changes: 2 additions & 32 deletions ietf/secr/drafts/email.py
@@ -1,7 +1,6 @@
import datetime
import glob
import os
import time

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

elif action == 'new':
# if the ID belongs to a group other than "none" add line to message body
if draft.group.type.slug == 'wg':
wg_message = 'This draft is a work item of the %s Working Group of the IETF.' % draft.group.name
else:
wg_message = ''
context = {'wg_message':wg_message,
'draft':draft,
'authors':get_abbr_authors(draft),
'revision_date':draft.latest_event(type='new_revision').time.date(),
'timestamp':time.strftime("%Y-%m-%d%H%M%S", time.localtime())}
data['to'] = 'i-d-announce@ietf.org'
data['cc'] = draft.group.list_email
data['subject'] = 'I-D Action: %s' % (curr_filename)
data['body'] = render_to_string('drafts/message_new.txt', context)

elif action == 'replace':
'''
input['replaced'] is a DocAlias
input['replaced_by'] is a Document
'''
context = {'doc':input['replaced'],'replaced_by':input['replaced_by']}
data['subject'] = 'Replacement of %s with %s' % (input['replaced'],input['replaced_by'])
data['body'] = render_to_string('drafts/message_replace.txt', context)
data['replaced'] = input['replaced']
data['replaced_by'] = input['replaced_by']

elif action == 'resurrect':
last_revision = get_last_revision(draft.name)
last_filename = draft.name + '-' + last_revision + '.txt'
Expand Down
12 changes: 12 additions & 0 deletions ietf/secr/drafts/tests_views.py
Expand Up @@ -14,6 +14,8 @@
from ietf.doc.models import State, Document
from ietf.meeting.factories import MeetingFactory
from ietf.person.factories import PersonFactory
from ietf.person.models import Person
from ietf.submit.models import Preapproval
from ietf.submit.tests import submission_file
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
from ietf.utils.test_data import make_test_data
Expand Down Expand Up @@ -72,6 +74,16 @@ def test_add(self):
response = self.client.post(url,post)
self.assertEqual(response.status_code, 302)

def test_approvals(self):
make_test_data()
Preapproval.objects.create(name='draft-dummy',
by=Person.objects.get(name="(System)"))
url = urlreverse('ietf.secr.drafts.views.approvals')
self.client.login(username="secretary", password="secretary+password")
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertTrue('draft-dummy' in response.content)

def test_edit(self):
draft = make_test_data()
url = urlreverse('ietf.secr.drafts.views.edit', kwargs={'id':draft.name})
Expand Down
36 changes: 0 additions & 36 deletions ietf/secr/templates/drafts/message_new.txt

This file was deleted.

4 changes: 0 additions & 4 deletions ietf/secr/templates/drafts/message_replace.txt

This file was deleted.

30 changes: 0 additions & 30 deletions ietf/secr/templates/drafts/replace.html

This file was deleted.

0 comments on commit f64bf95

Please sign in to comment.