Fix more test errors - now only two not yet fully ported views remain
- Legacy-Id: 8571
This commit is contained in:
parent
279eab24f6
commit
87870ca954
|
@ -1,6 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
from south.v2 import DataMigration
|
||||
import debug
|
||||
|
||||
class Migration(DataMigration):
|
||||
|
||||
|
|
|
@ -8,8 +8,9 @@ from email.utils import parseaddr
|
|||
|
||||
from ietf.doc.models import ConsensusDocEvent
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
from django.utils.html import escape, fix_ampersands
|
||||
from django.template.defaultfilters import truncatewords_html, linebreaksbr, stringfilter, urlize, striptags
|
||||
from django.template.defaultfilters import truncatewords_html, linebreaksbr, stringfilter, striptags, urlize
|
||||
from django.template import resolve_variable
|
||||
from django.utils.safestring import mark_safe, SafeData
|
||||
from django.utils.html import strip_tags
|
||||
|
@ -528,7 +529,6 @@ def pos_to_label(text):
|
|||
|
||||
@register.filter
|
||||
def capfirst_allcaps(text):
|
||||
from django.template import defaultfilters
|
||||
"""Like capfirst, except it doesn't lowercase words in ALL CAPS."""
|
||||
result = text
|
||||
i = False
|
||||
|
@ -543,10 +543,8 @@ def capfirst_allcaps(text):
|
|||
|
||||
@register.filter
|
||||
def lower_allcaps(text):
|
||||
from django.template import defaultfilters
|
||||
"""Like lower, except it doesn't lowercase words in ALL CAPS."""
|
||||
result = text
|
||||
i = False
|
||||
for token in re.split("(\W+)", striptags(text)):
|
||||
if not re.match("^[A-Z]+$", token):
|
||||
result = result.replace(token, token.lower())
|
||||
|
@ -561,7 +559,6 @@ def urlize_html(html, autoescape=False):
|
|||
"""
|
||||
try:
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
from django.utils.html import urlize
|
||||
except ImportError:
|
||||
if settings.DEBUG:
|
||||
raise template.TemplateSyntaxError, "Error in urlize_html The Python BeautifulSoup libraries aren't installed."
|
||||
|
|
|
@ -45,13 +45,13 @@ class ConflictReviewTests(TestCase):
|
|||
r = self.client.post(url,dict(create_in_state=""))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
self.assertEqual(Document.objects.filter(name='conflict-review-imaginary-independent-submission').count() , 0)
|
||||
|
||||
r = self.client.post(url,dict(ad=""))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
self.assertEqual(Document.objects.filter(name='conflict-review-imaginary-independent-submission').count() , 0)
|
||||
|
||||
# successful review start
|
||||
|
@ -139,7 +139,7 @@ class ConflictReviewTests(TestCase):
|
|||
r = self.client.post(url,dict(review_state=""))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# successful change to AD Review
|
||||
adrev_pk = str(State.objects.get(used=True, slug='adrev',type__slug='conflrev').pk)
|
||||
|
@ -274,7 +274,7 @@ class ConflictReviewTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('form.approve')),1)
|
||||
self.assertEqual(len(q('[type=submit]:contains("Send announcement")')), 1)
|
||||
if approve_type == 'appr-noprob':
|
||||
self.assertTrue( 'IESG has no problem' in ''.join(wrap(r.content,2**16)))
|
||||
else:
|
||||
|
|
|
@ -41,25 +41,25 @@ class StatusChangeTests(TestCase):
|
|||
r = self.client.post(url,dict(document_name="bogus",title="Bogus Title",ad="",create_in_state=state_strpk,notify='ipu@ietf.org'))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
## Must set a name
|
||||
r = self.client.post(url,dict(document_name="",title="Bogus Title",ad=ad_strpk,create_in_state=state_strpk,notify='ipu@ietf.org'))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
## Must not choose a document name that already exists
|
||||
r = self.client.post(url,dict(document_name="imaginary-mid-review",title="Bogus Title",ad=ad_strpk,create_in_state=state_strpk,notify='ipu@ietf.org'))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
## Must set a title
|
||||
r = self.client.post(url,dict(document_name="bogus",title="",ad=ad_strpk,create_in_state=state_strpk,notify='ipu@ietf.org'))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# successful status change start
|
||||
r = self.client.post(url,dict(document_name="imaginary-new",title="A new imaginary status change",ad=ad_strpk,
|
||||
|
@ -90,7 +90,7 @@ class StatusChangeTests(TestCase):
|
|||
r = self.client.post(url,dict(new_state=""))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# successful change to AD Review
|
||||
adrev_pk = str(State.objects.get(slug='adrev',type__slug='statchg').pk)
|
||||
|
@ -283,7 +283,7 @@ class StatusChangeTests(TestCase):
|
|||
messages_before = len(outbox)
|
||||
r = self.client.post(url,dict(last_call_text='stuff',send_last_call_request='Save+and+Request+Last+Call'))
|
||||
self.assertEqual(r.status_code,200)
|
||||
self.assertTrue( 'Last Call Requested' in ''.join(wrap(r.content,2**16)))
|
||||
self.assertTrue( 'Last call requested' in ''.join(wrap(r.content,2**16)))
|
||||
self.assertEqual(len(outbox), messages_before + 1)
|
||||
self.assertTrue('iesg-secretary' in outbox[-1]['To'])
|
||||
self.assertTrue('Last Call:' in outbox[-1]['Subject'])
|
||||
|
@ -307,7 +307,7 @@ class StatusChangeTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('form.approve')),1)
|
||||
self.assertEqual(len(q('[type=submit]:contains("Send announcement")')), 1)
|
||||
# There should be two messages to edit
|
||||
self.assertEqual(q('input#id_form-TOTAL_FORMS').val(),'2')
|
||||
self.assertTrue( '(rfc9999) to Internet Standard' in ''.join(wrap(r.content,2**16)))
|
||||
|
@ -345,7 +345,7 @@ class StatusChangeTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('form.edit-status-change-rfcs')),1)
|
||||
self.assertEqual(len(q('.content-wrapper [type=submit]:contains("Save")')),1)
|
||||
# There should be three rows on the form
|
||||
self.assertEqual(len(q('tr[id^=relation_row]')),3)
|
||||
|
||||
|
@ -355,7 +355,7 @@ class StatusChangeTests(TestCase):
|
|||
Submit="Submit"))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# Try to add a relation leaving the relation type blank
|
||||
r = self.client.post(url,dict(new_relation_row_blah="rfc9999",
|
||||
|
@ -363,7 +363,7 @@ class StatusChangeTests(TestCase):
|
|||
Submit="Submit"))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# Try to add a relation with an unknown relationship type
|
||||
r = self.client.post(url,dict(new_relation_row_blah="rfc9999",
|
||||
|
@ -371,7 +371,7 @@ class StatusChangeTests(TestCase):
|
|||
Submit="Submit"))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# Successful change of relations
|
||||
r = self.client.post(url,dict(new_relation_row_blah="rfc9999",
|
||||
|
|
|
@ -99,7 +99,7 @@ class GroupPagesTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('table.ietf-doctable td.acronym a:contains("%s")' % group.acronym)), 1)
|
||||
self.assertEqual(len(q('.content-wrapper a:contains("%s")' % group.acronym)), 1)
|
||||
|
||||
def test_concluded_groups(self):
|
||||
draft = make_test_data()
|
||||
|
@ -111,7 +111,7 @@ class GroupPagesTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('table.concluded-groups a:contains("%s")' % group.acronym)), 1)
|
||||
self.assertEqual(len(q('.content-wrapper a:contains("%s")' % group.acronym)), 1)
|
||||
|
||||
def test_bofs(self):
|
||||
draft = make_test_data()
|
||||
|
@ -123,7 +123,7 @@ class GroupPagesTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('table.ietf-doctable td.acronym a:contains("%s")' % group.acronym)), 1)
|
||||
self.assertEqual(len(q('.content-wrapper a:contains("%s")' % group.acronym)), 1)
|
||||
|
||||
def test_group_documents(self):
|
||||
draft = make_test_data()
|
||||
|
@ -302,7 +302,7 @@ class GroupEditTests(TestCase):
|
|||
r = self.client.post(url, dict(acronym="foobarbaz")) # No name
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
self.assertEqual(len(Group.objects.filter(type="wg")), num_wgs)
|
||||
|
||||
# acronym contains non-alphanumeric
|
||||
|
@ -330,7 +330,7 @@ class GroupEditTests(TestCase):
|
|||
self.assertEqual(group.charter.name, "charter-ietf-testwg")
|
||||
self.assertEqual(group.charter.rev, "00-00")
|
||||
|
||||
def test_create_based_on_existing(self):
|
||||
def test_create_based_on_existing_bof(self):
|
||||
make_test_data()
|
||||
|
||||
url = urlreverse('group_create', kwargs=dict(group_type="wg"))
|
||||
|
@ -342,7 +342,7 @@ class GroupEditTests(TestCase):
|
|||
r = self.client.post(url, dict(name="Test", acronym=group.parent.acronym))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
self.assertEqual(len(q('form input[name="confirmed"]')), 0) # can't confirm us out of this
|
||||
|
||||
# try elevating BoF to WG
|
||||
|
@ -352,7 +352,7 @@ class GroupEditTests(TestCase):
|
|||
r = self.client.post(url, dict(name="Test", acronym=group.acronym))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
self.assertEqual(len(q('form input[name="confirmed"]')), 1)
|
||||
|
||||
self.assertEqual(Group.objects.get(acronym=group.acronym).state_id, "bof")
|
||||
|
@ -383,7 +383,7 @@ class GroupEditTests(TestCase):
|
|||
r = self.client.post(url, dict(acronym="collide"))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# create old acronym
|
||||
group.acronym = "oldmars"
|
||||
|
@ -396,7 +396,7 @@ class GroupEditTests(TestCase):
|
|||
r = self.client.post(url, dict(acronym="oldmars"))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# edit info
|
||||
with open(os.path.join(self.charter_dir, "%s-%s.txt" % (group.charter.canonical_name(), group.charter.rev)), "w") as f:
|
||||
|
@ -453,7 +453,7 @@ class GroupEditTests(TestCase):
|
|||
r = self.client.post(url, dict(instructions="")) # No instructions
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('form ul.errorlist')) > 0)
|
||||
self.assertTrue(len(q('form .has-error')) > 0)
|
||||
|
||||
# request conclusion
|
||||
mailbox_before = len(outbox)
|
||||
|
|
|
@ -158,7 +158,7 @@ class IprTests(TestCase):
|
|||
})
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q("ul.errorlist")) > 0)
|
||||
self.assertTrue(len(q("form .has-error")) > 0)
|
||||
|
||||
# successful post
|
||||
r = self.client.post(url, {
|
||||
|
|
|
@ -18,13 +18,13 @@ class MailingListTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q(".group-archives a:contains(\"%s\")" % group.acronym)), 0)
|
||||
self.assertEqual(len(q(".content-wrapper a:contains(\"%s\")" % group.acronym)), 0)
|
||||
|
||||
# successful get
|
||||
group.list_archive = "https://example.com/foo"
|
||||
group.save()
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q(".group-archives a:contains(\"%s\")" % group.acronym)), 1)
|
||||
self.assertEqual(len(q(".content-wrapper a:contains(\"%s\")" % group.acronym)), 1)
|
||||
|
||||
|
||||
|
|
|
@ -38,19 +38,22 @@ class MeetingTests(TestCase):
|
|||
session = Session.objects.filter(meeting=meeting, group__acronym="mars").first()
|
||||
slot = TimeSlot.objects.get(scheduledsession__session=session)
|
||||
|
||||
time_interval = "%s-%s" % (slot.time.strftime("%H%M"), (slot.time + slot.duration).strftime("%H%M"))
|
||||
time_interval = "%s-%s" % (slot.time.strftime("%H:%M").lstrip("0"), (slot.time + slot.duration).strftime("%H:%M").lstrip("0"))
|
||||
|
||||
# plain
|
||||
r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number)))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
agenda_content = q("#agenda").html()
|
||||
agenda_content = q(".content-wrapper").html()
|
||||
self.assertTrue(session.group.acronym in agenda_content)
|
||||
self.assertTrue(session.group.name in agenda_content)
|
||||
self.assertTrue(session.group.parent.acronym.upper() in agenda_content)
|
||||
self.assertTrue(slot.location.name in agenda_content)
|
||||
self.assertTrue(time_interval in agenda_content)
|
||||
|
||||
# the rest of the results don't have as nicely formatted times
|
||||
time_interval = time_interval.replace(":", "")
|
||||
|
||||
# mobile
|
||||
r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number)),
|
||||
{ '_testiphone': "1" })
|
||||
|
@ -124,12 +127,11 @@ class MeetingTests(TestCase):
|
|||
|
||||
r = self.client.get(urlreverse("ietf.meeting.views.materials", kwargs=dict(meeting_num=meeting.number)))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
#debug.show('r.content')
|
||||
q = PyQuery(r.content)
|
||||
row = q('.ietf-materials b:contains("%s")' % str(session.group.acronym.upper())).closest("tr")
|
||||
self.assertTrue(row.find("a:contains(\"Agenda\")"))
|
||||
self.assertTrue(row.find("a:contains(\"Minutes\")"))
|
||||
self.assertTrue(row.find("a:contains(\"Slideshow\")"))
|
||||
row = q('.content-wrapper td:contains("%s")' % str(session.group.acronym)).closest("tr")
|
||||
self.assertTrue(row.find('a:contains("Agenda")'))
|
||||
self.assertTrue(row.find('a:contains("Minutes")'))
|
||||
self.assertTrue(row.find('a:contains("Slideshow")'))
|
||||
|
||||
# FIXME: missing tests of .pdf/.tar generation (some code can
|
||||
# probably be lifted from similar tests in iesg/tests.py)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# -*- coding: UTF-8-No-BOM -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
import tempfile
|
||||
import datetime
|
||||
|
||||
|
@ -214,31 +214,36 @@ class NomcomViewsTest(TestCase):
|
|||
"primary_email": nominees[0]}
|
||||
response = self.client.post(self.private_merge_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-error")
|
||||
q = PyQuery(response.content)
|
||||
self.assertTrue(q("form .has-error"))
|
||||
|
||||
test_data = {"primary_email": nominees[0],
|
||||
"secondary_emails": ""}
|
||||
response = self.client.post(self.private_merge_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-error")
|
||||
q = PyQuery(response.content)
|
||||
self.assertTrue(q("form .has-error"))
|
||||
|
||||
test_data = {"primary_email": "",
|
||||
"secondary_emails": nominees[0]}
|
||||
response = self.client.post(self.private_merge_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-error")
|
||||
q = PyQuery(response.content)
|
||||
self.assertTrue(q("form .has-error"))
|
||||
|
||||
test_data = {"primary_email": "unknown@example.com",
|
||||
"secondary_emails": nominees[0]}
|
||||
response = self.client.post(self.private_merge_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-error")
|
||||
q = PyQuery(response.content)
|
||||
self.assertTrue(q("form .has-error"))
|
||||
|
||||
test_data = {"primary_email": nominees[0],
|
||||
"secondary_emails": "unknown@example.com"}
|
||||
response = self.client.post(self.private_merge_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-error")
|
||||
q = PyQuery(response.content)
|
||||
self.assertTrue(q("form .has-error"))
|
||||
|
||||
test_data = {"secondary_emails": """%s,
|
||||
%s,
|
||||
|
@ -247,7 +252,7 @@ class NomcomViewsTest(TestCase):
|
|||
|
||||
response = self.client.post(self.private_merge_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-success")
|
||||
self.assertContains(response, "alert-success")
|
||||
|
||||
self.assertEqual(Nominee.objects.filter(email__address=nominees[1],
|
||||
duplicated__isnull=False).count(), 1)
|
||||
|
@ -433,7 +438,8 @@ class NomcomViewsTest(TestCase):
|
|||
|
||||
nomcom = get_nomcom_by_year(self.year)
|
||||
if not nomcom.public_key:
|
||||
self.assertNotContains(response, "nominateform")
|
||||
q = PyQuery(response.content)
|
||||
self.assertEqual(len(q("#nominate-form")), 0)
|
||||
|
||||
# save the cert file in tmp
|
||||
nomcom.public_key.storage.location = tempfile.gettempdir()
|
||||
|
@ -441,7 +447,8 @@ class NomcomViewsTest(TestCase):
|
|||
|
||||
response = self.client.get(nominate_url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "nominateform")
|
||||
q = PyQuery(response.content)
|
||||
self.assertEqual(len(q("#nominate-form")), 1)
|
||||
|
||||
position = Position.objects.get(name=position_name)
|
||||
candidate_email = nominee_email
|
||||
|
@ -459,7 +466,8 @@ class NomcomViewsTest(TestCase):
|
|||
|
||||
response = self.client.post(nominate_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-success")
|
||||
q = PyQuery(response.content)
|
||||
self.assertContains(response, "alert-success")
|
||||
|
||||
# check objects
|
||||
email = Email.objects.get(address=candidate_email)
|
||||
|
@ -526,7 +534,7 @@ class NomcomViewsTest(TestCase):
|
|||
response = self.client.post(self.add_questionnaire_url, test_data)
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-success")
|
||||
self.assertContains(response, "alert-success")
|
||||
|
||||
## check objects
|
||||
feedback = Feedback.objects.filter(positions__in=[position],
|
||||
|
@ -597,17 +605,18 @@ class NomcomViewsTest(TestCase):
|
|||
nominee_position = NomineePosition.objects.get(nominee=nominee,
|
||||
position=position)
|
||||
state = nominee_position.state
|
||||
if not state.slug == 'accepted':
|
||||
if state.slug != 'accepted':
|
||||
response = self.client.post(feedback_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-error")
|
||||
q = PyQuery(response.content)
|
||||
self.assertTrue(q("form .has-error"))
|
||||
# accept nomination
|
||||
nominee_position.state = NomineePositionStateName.objects.get(slug='accepted')
|
||||
nominee_position.save()
|
||||
|
||||
response = self.client.post(feedback_url, test_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "info-message-success")
|
||||
self.assertContains(response, "alert-success")
|
||||
|
||||
## check objects
|
||||
feedback = Feedback.objects.filter(positions__in=[position],
|
||||
|
|
|
@ -311,8 +311,8 @@ def nominate(request, year, public):
|
|||
template = 'nomcom/private_nominate.html'
|
||||
|
||||
if not has_publickey:
|
||||
message = ('warning', "This Nomcom is not yet accepting nominations")
|
||||
return render_to_response(template,
|
||||
message = ('warning', "This Nomcom is not yet accepting nominations")
|
||||
return render_to_response(template,
|
||||
{'message': message,
|
||||
'nomcom': nomcom,
|
||||
'year': year,
|
||||
|
|
|
@ -89,7 +89,7 @@ class SubmitTests(TestCase):
|
|||
# check the page
|
||||
r = self.client.get(status_url)
|
||||
q = PyQuery(r.content)
|
||||
post_button = q('input[type=submit][value*="Post"]')
|
||||
post_button = q('[type=submit]:contains("Post")')
|
||||
self.assertEqual(len(post_button), 1)
|
||||
action = post_button.parents("form").find('input[type=hidden][name="action"]').val()
|
||||
|
||||
|
@ -142,7 +142,7 @@ class SubmitTests(TestCase):
|
|||
r = self.client.get(status_url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
approve_button = q('input[type=submit][value*="Approve"]')
|
||||
approve_button = q('[type=submit]:contains("Approve")')
|
||||
self.assertEqual(len(approve_button), 1)
|
||||
|
||||
action = approve_button.parents("form").find('input[type=hidden][name="action"]').val()
|
||||
|
@ -237,7 +237,7 @@ class SubmitTests(TestCase):
|
|||
# go to confirm page
|
||||
r = self.client.get(confirm_url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('input[type=submit][value*="Confirm"]')), 1)
|
||||
self.assertEqual(len(q('[type=submit]:contains("Confirm")')), 1)
|
||||
|
||||
# confirm
|
||||
mailbox_before = len(outbox)
|
||||
|
@ -305,7 +305,7 @@ class SubmitTests(TestCase):
|
|||
# go to confirm page
|
||||
r = self.client.get(confirm_url)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('input[type=submit][value*="Confirm"]')), 1)
|
||||
self.assertEqual(len(q('[type=submit]:contains("Confirm")')), 1)
|
||||
|
||||
# confirm
|
||||
mailbox_before = len(outbox)
|
||||
|
@ -363,10 +363,10 @@ class SubmitTests(TestCase):
|
|||
r = self.client.get(status_url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
cancel_button = q('input[type=submit][value*="Cancel"]')
|
||||
cancel_button = q('[type=submit]:contains("Cancel")')
|
||||
self.assertEqual(len(cancel_button), 1)
|
||||
|
||||
action = cancel_button.parents("form").find("input[type=hidden][name=\"action\"]").val()
|
||||
action = cancel_button.parents("form").find('input[type=hidden][name="action"]').val()
|
||||
|
||||
# cancel
|
||||
r = self.client.post(status_url, dict(action=action))
|
||||
|
@ -385,7 +385,7 @@ class SubmitTests(TestCase):
|
|||
r = self.client.get(status_url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
adjust_button = q('input[type=submit][value*="Adjust"]')
|
||||
adjust_button = q('[type=submit]:contains("Adjust")')
|
||||
self.assertEqual(len(adjust_button), 1)
|
||||
|
||||
action = adjust_button.parents("form").find('input[type=hidden][name="action"]').val()
|
||||
|
@ -447,7 +447,7 @@ class SubmitTests(TestCase):
|
|||
r = self.client.get(status_url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
post_button = q('input[type=submit][value*="Force"]')
|
||||
post_button = q('[type=submit]:contains("Force")')
|
||||
self.assertEqual(len(post_button), 1)
|
||||
|
||||
action = post_button.parents("form").find('input[type=hidden][name="action"]').val()
|
||||
|
@ -482,16 +482,16 @@ class SubmitTests(TestCase):
|
|||
# status page as unpriviliged => no edit button
|
||||
r = self.client.get(unprivileged_status_url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertTrue(("status of submission of %s" % name) in r.content.lower())
|
||||
self.assertTrue(("submission status of %s" % name) in r.content.lower())
|
||||
q = PyQuery(r.content)
|
||||
adjust_button = q('input[type=submit][value*="Adjust"]')
|
||||
adjust_button = q('[type=submit]:contains("Adjust")')
|
||||
self.assertEqual(len(adjust_button), 0)
|
||||
|
||||
# as Secretariat, we should get edit button
|
||||
self.client.login(username="secretary", password="secretary+password")
|
||||
r = self.client.get(unprivileged_status_url)
|
||||
q = PyQuery(r.content)
|
||||
adjust_button = q('input[type=submit][value*="Adjust"]')
|
||||
adjust_button = q('[type=submit]:contains("Adjust")')
|
||||
self.assertEqual(len(adjust_button), 1)
|
||||
|
||||
action = adjust_button.parents("form").find('input[type=hidden][name="action"]').val()
|
||||
|
@ -521,13 +521,13 @@ class SubmitTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
request_button = q('input[type=submit][value*="Request full access"]')
|
||||
request_button = q('[type=submit]:contains("Request full access")')
|
||||
self.assertEqual(len(request_button), 1)
|
||||
|
||||
# request URL to be sent
|
||||
mailbox_before = len(outbox)
|
||||
|
||||
action = request_button.parents("form").find("input[type=hidden][name=\"action\"]").val()
|
||||
action = request_button.parents("form").find('input[type=hidden][name="action"]').val()
|
||||
r = self.client.post(url, dict(action=action))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
|
@ -650,12 +650,13 @@ class ApprovalsTestCase(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('input[type=submit]')), 1)
|
||||
self.assertEqual(len(q('[type=submit]:contains("Save")')), 1)
|
||||
|
||||
# faulty post
|
||||
r = self.client.post(url, dict(name="draft-test-nonexistingwg-something"))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertTrue("errorlist" in r.content)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q("form .has-error")) > 0)
|
||||
|
||||
# add
|
||||
name = "draft-ietf-mars-foo"
|
||||
|
@ -676,7 +677,7 @@ class ApprovalsTestCase(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('input[type=submit]')), 1)
|
||||
self.assertEqual(len(q('[type=submit]:contains("Cancel")')), 1)
|
||||
|
||||
# cancel
|
||||
r = self.client.post(url, dict(action="cancel"))
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
{% endif %}
|
||||
|
||||
<div class="buttonlist">
|
||||
<button type="submit" class="btn btn-primary" name="Submit">Submit</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<a class="btn btn-default pull-right" href="{% url "doc_view" name=doc.name %}">Back</a>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
{% if nomcom|has_publickey %}
|
||||
|
||||
<form role="form" method="post">
|
||||
<form id="nominate-form" role="form" method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons %}
|
||||
<input class="btn btn-primary" type="submit" value="Save">
|
||||
{% endbuttons %}
|
||||
<button class="btn btn-primary" type="submit" name="save">Save</button>
|
||||
{% endbuttons %}
|
||||
</form>
|
||||
|
||||
{% endif %}
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
{% bootstrap_messages %}
|
||||
|
||||
{% if nomcom|has_publickey %}
|
||||
<form id="nominateform" role="form" method="post">
|
||||
<form id="nominate-form" role="form" method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons %}
|
||||
<input class="btn btn-primary" type="submit" value="Save" name="save">
|
||||
<button class="btn btn-primary" type="submit" name="save">Save</button>
|
||||
{% endbuttons %}
|
||||
</form>
|
||||
{% endif %}
|
||||
|
|
|
@ -44,7 +44,7 @@ like <code>.txt</code> in the name.</p>
|
|||
{% bootstrap_form form %}
|
||||
|
||||
{% buttons %}
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<a class="btn btn-default pull-right" href="{% url "submit_approvals" %}#preapprovals">Back</a>
|
||||
{% endbuttons %}
|
||||
</form>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{% if not approvals %}
|
||||
<p>You don't have any submissions to approve.</p>
|
||||
{% else %}
|
||||
<table class="table table-condensed table-striped">
|
||||
<table class="approvals table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Draft</th>
|
||||
|
@ -39,7 +39,7 @@
|
|||
{% if not preapprovals %}
|
||||
<p>No pre-approvals within your jurisdiction found.</p>
|
||||
{% else %}
|
||||
<table class="table table-condensed table-striped">
|
||||
<table class="preapprovals table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Draft name</th>
|
||||
|
@ -66,7 +66,7 @@
|
|||
{% if not recently_approved %}
|
||||
<p>No drafts approved.</p>
|
||||
{% else %}
|
||||
<table class="table table-condensed table-striped">
|
||||
<table class="recently-approved table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Draft</th>
|
||||
|
@ -85,7 +85,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
<h2>Submission approvals</h2>
|
||||
<h2>Submission of approvals</h2>
|
||||
<p>
|
||||
This is where chairs and the secretariat can approve and pre-approve document
|
||||
submissions which require approval, such as WG -00 drafts.
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="edit">
|
||||
<input class="btn btn-warning" type="submit" value="Adjust meta-data" value="adjust">
|
||||
<button class="btn btn-warning" type="submit" value="adjust">Adjust meta-data</button>
|
||||
</form>
|
||||
</p>
|
||||
<p>Leads to manual post by the secretariat.</p>
|
||||
|
@ -217,7 +217,7 @@
|
|||
{% csrf_token %}
|
||||
{% include "submit/submitter_form.html" %}
|
||||
<input type="hidden" name="action" value="autopost">
|
||||
<input class="btn btn-primary" type="submit" value="Post submission">
|
||||
<button class="btn btn-primary" type="submit">Post submission</button>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
|
@ -249,8 +249,8 @@
|
|||
<form id="cancel-submission" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="cancel">
|
||||
<input class="btn btn-danger" type="submit" value="Cancel submission">
|
||||
</form>
|
||||
<button class="btn btn-danger" type="submit">Cancel submission</button>
|
||||
</form>
|
||||
</p>
|
||||
<p>Deletes the uploaded file{{ submission.file_types|split:","|pluralize }} permanently.</p>
|
||||
{% endif %}
|
||||
|
@ -261,8 +261,8 @@
|
|||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="approve">
|
||||
<input class="btn btn-danger" type="submit" value="Approve this submission">
|
||||
</form>
|
||||
<button class="btn btn-danger" type="submit">Approve this submission</button>
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
|
@ -271,7 +271,7 @@
|
|||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="forcepost">
|
||||
<input class="btn btn-danger" type="submit" value="Force post of submission">
|
||||
<button class="btn btn-danger" type="submit">Force post of submission</button>
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
@ -293,8 +293,8 @@
|
|||
<p>
|
||||
<form method="post">{% csrf_token %}
|
||||
<input type="hidden" name="action" value="sendfullurl">
|
||||
<input class="btn btn-default" type="submit" value="Request full access URL">
|
||||
</form>
|
||||
<button class="btn btn-danger" type="submit">Request full access URL</button>
|
||||
</form>
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue