Restored a test that was unintentionally removed. Removed unused templates. Related to #2513. Commit ready for merge.

- Legacy-Id: 15114
This commit is contained in:
Robert Sparks 2018-05-03 18:42:59 +00:00
parent 7d2ac8306e
commit f64bf957f3
5 changed files with 14 additions and 102 deletions

View file

@ -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
@ -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)
@ -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'

View file

@ -14,6 +14,8 @@ from ietf.doc.factories import DocumentFactory
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
@ -72,6 +74,16 @@ class SecrDraftsTestCase(TestCase):
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})

View file

@ -1,36 +0,0 @@
--NextPart
A new Internet-Draft is available from the on-line Internet-Drafts directories.
{{ wg_message }}
Title : {{ draft.title }}
Author(s) : {{ authors }}
Filename : {{ draft.name }}
Pages : {{ draft.pages }}
Date : {{ revision_date }}
{% autoescape off %}
{{ draft.abstract }}
{% endautoescape %}
A URL for this Internet-Draft is:
https://www.ietf.org/internet-drafts/{{ draft.filename_with_rev }}
Internet-Drafts are also available by anonymous FTP at:
ftp://ftp.ietf.org/internet-drafts/
Below is the data which will enable a MIME compliant mail reader
implementation to automatically retrieve the ASCII version of the
Internet-Draft.
--NextPart
Content-Type: Message/External-body;
name="{{ draft.name }}";
site="ftp.ietf.org";
access-type="anon-ftp";
directory="internet-drafts"
Content-Type: text/plain
Content-ID: <{{ timestamp }}.I-D@ietf.org>
--NextPart--

View file

@ -1,4 +0,0 @@
As you requested, {{ doc }} has been marked as replaced by
{{ replaced_by }} in the IETF Internet-Drafts database.
IETF Secretariat.

View file

@ -1,30 +0,0 @@
{% extends "base_site.html" %}
{% load staticfiles %}
{% block title %}Drafts - Replace{% endblock %}
{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script>
{% endblock %}
{% block breadcrumbs %}{{ block.super }}
&raquo; <a href="../../">Drafts</a>
&raquo; <a href="../">{{ draft.name }}</a>
&raquo; Replace
{% endblock %}
{% block content %}
<div class="module draft-container">
<h2>Draft - Replace</h2>
<form enctype="multipart/form-data" action="" method="post">{% csrf_token %}
<table class="full-width">
{{ form.as_table }}
</table>
{% include "includes/buttons_save_cancel.html" %}
</form>
</div> <!-- module -->
{% endblock %}