Fix failing tests

- Legacy-Id: 19982
This commit is contained in:
Jennifer Richards 2022-02-24 16:47:55 +00:00
parent 6c260a5b7e
commit 9d8f4ea207
9 changed files with 17 additions and 15 deletions

View file

@ -2724,7 +2724,7 @@ class RawIdTests(TestCase):
def should_succeed(self, argdict):
url = urlreverse(self.view, kwargs=argdict)
r = self.client.get(url)
r = self.client.get(url, skip_verify=True) # do not verify HTML, they're faked anyway
self.assertEqual(r.status_code,200)
self.assertEqual(r.get('Content-Type'),f"{self.mimetypes[argdict.get('ext','txt')]};charset=utf-8")

View file

@ -1196,9 +1196,9 @@ class BallotContentTests(TestCase):
)
def _assertBallotMessage(self, q, balloter, expected):
heading = q(f'h4[id$="_{slugify(balloter.plain_name())}"]')
heading = q(f'h5[id$="_{slugify(balloter.plain_name())}"]')
self.assertEqual(len(heading), 1)
# <h4/> is followed by a panel with the message of interest, so use next()
# <h5/> is followed by a panel with the message of interest, so use next()
self.assertEqual(
len(heading.next().find(
f'*[title="{expected}"]'

View file

@ -8,7 +8,7 @@ from pathlib import Path
from pyquery import PyQuery
from random import randint
from tempfile import NamedTemporaryFile
from html import escape, unescape
from html import unescape
from django.conf import settings
from django.urls import reverse as urlreverse

View file

@ -135,7 +135,7 @@ class EditMeetingScheduleTests(IetfSeleniumTestCase):
self.assertEqual(session_info_container.find_element(By.CSS_SELECTOR, ".other-session .time").text, "not yet scheduled")
# deselect
self.driver.find_element(By.CSS_SELECTOR, '.scheduling-panel').click()
self.driver.find_element(By.CSS_SELECTOR, '.drop-target').click()
self.assertEqual(session_info_container.find_elements(By.CSS_SELECTOR, ".title"), [])
self.assertNotIn('other-session-selected', s2b_element.get_attribute('class'))

View file

@ -4181,6 +4181,6 @@ def import_session_minutes(request, session_id, num):
'form': form,
'note': note,
'session': session,
'contents_changed': contents_changed,
'contents_unchanged': not contents_changed,
},
)

View file

@ -1,5 +1,5 @@
{% extends "base.html" %}
{% load bootstrap3 origin %}
{% load django_bootstrap5 origin %}
{% block morecss %}
#preview { width: 100%; height: 60vh; border: solid 2px; }
@ -26,10 +26,9 @@
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button type="submit" class="btn btn-primary pull-left" {% if not contents_changed %}disabled{% endif %}> Import </button>
<a class="btn btn-default pull-right" href="{% url 'ietf.meeting.views.session_details' num=session.meeting.number acronym=session.group.acronym %}"> Back </a>
{% endbuttons %}
{% bootstrap_button "Import" button_type="submit" disabled=contents_unchanged %}
{% url 'ietf.meeting.views.session_details' num=session.meeting.number acronym=session.group.acronym as back_url %}
{% bootstrap_button "Back" button_type="link" href=back_url %}
</form>
</div>
</div>

View file

@ -80,7 +80,7 @@
{% else %}
{% url 'ietf.meeting.views.upload_session_bluesheets' session_id=session.pk num=session.meeting.number as upload_url %}
{% endif %}
{% if ag.document.type.slug != 'bluesheets' or user|has_role:"Secretariat" or meeting.type.slug == 'interim' and can_manage_materials %}
{% if pres.document.type.slug != 'bluesheets' or user|has_role:"Secretariat" or meeting.type.slug == 'interim' and can_manage_materials %}
{% if pres.document.type.slug == 'minutes' %}
<a class="btn btn-primary btn-sm" href="{% url 'ietf.meeting.views.import_session_minutes' num=session.meeting.number session_id=session.pk %}">Import from notes.ietf.org</a>
{% endif %}

View file

@ -8,7 +8,6 @@ import bleach
from django import template
from django.conf import settings
from django.template.defaultfilters import stringfilter
from django.utils.html import escape
from django.utils.safestring import mark_safe
import debug # pyflakes:ignore

View file

@ -160,12 +160,16 @@ class VerifyingClient(Client):
super(VerifyingClient, self).__init__()
self.test = test
def get(self, path, *args, **extra):
def get(self, path, *args, skip_verify=False, **extra):
"""GET request
Performs verification of HTML responses unless skip_verify is True.
"""
r = super(VerifyingClient, self).get(path, *args, **extra)
# print(path, r.status_code, r["content-type"].lower())
if r.status_code < 300 and r["content-type"].lower().startswith(
"text/html"
):
) and not skip_verify:
document, errors = tidy_document(
r.content,
options={