Found (manually) and fixed a place where a sessionpresentation object's rev=None was exploding a template. FactoryBoy starts to really shine.
- Legacy-Id: 10851
This commit is contained in:
parent
1a2b885864
commit
4a12225742
|
@ -4,7 +4,7 @@ import datetime
|
|||
|
||||
from django.db.models import Max
|
||||
|
||||
from ietf.meeting.models import Meeting, Session, Schedule, TimeSlot
|
||||
from ietf.meeting.models import Meeting, Session, Schedule, TimeSlot, SessionPresentation
|
||||
from ietf.group.factories import GroupFactory
|
||||
from ietf.person.factories import PersonFactory
|
||||
|
||||
|
@ -96,4 +96,13 @@ class TimeSlotFactory(factory.DjangoModelFactory):
|
|||
def duration(self):
|
||||
return datetime.timedelta(minutes=30+random.randrange(9)*15)
|
||||
|
||||
class SessionPresentationFactory(factory.DjangoModelFactory):
|
||||
class Meta:
|
||||
model = SessionPresentation
|
||||
|
||||
session = factory.SubFactory(SessionFactory)
|
||||
document = factory.SubFactory('ietf.doc.factories.DocumentFactory')
|
||||
@factory.lazy_attribute
|
||||
def rev(self):
|
||||
return self.document.rev
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ from ietf.meeting.models import Session, TimeSlot
|
|||
from ietf.meeting.test_data import make_meeting_test_data
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized, unicontent
|
||||
|
||||
from ietf.group.factories import GroupFactory
|
||||
from ietf.meeting.factories import SessionFactory, SessionPresentationFactory
|
||||
|
||||
class MeetingTests(TestCase):
|
||||
def setUp(self):
|
||||
self.materials_dir = os.path.abspath(settings.TEST_MATERIALS_DIR)
|
||||
|
@ -156,13 +159,6 @@ class MeetingTests(TestCase):
|
|||
r = self.client.get(url)
|
||||
self.assertTrue(all([x in unicontent(r) for x in ['mars','IESG Breakfast','Test Room','Breakfast Room']]))
|
||||
|
||||
def test_session_details(self):
|
||||
meeting = make_meeting_test_data()
|
||||
url = urlreverse("ietf.meeting.views.session_details", kwargs=dict(num=meeting.number, acronym="mars"))
|
||||
r = self.client.get(url)
|
||||
self.assertTrue(all([x in unicontent(r) for x in ('slides','agenda','minutes')]))
|
||||
self.assertFalse('deleted' in unicontent(r))
|
||||
|
||||
def test_materials(self):
|
||||
meeting = make_meeting_test_data()
|
||||
session = Session.objects.filter(meeting=meeting, group__acronym="mars").first()
|
||||
|
@ -330,3 +326,20 @@ class EditTests(TestCase):
|
|||
ames_slot_qs.update(time=mars_ends + datetime.timedelta(seconds=10 * 60))
|
||||
self.assertTrue(mars_slot.slot_to_the_right)
|
||||
self.assertTrue(mars_scheduled.slot_to_the_right)
|
||||
|
||||
class SessionDetailsTests(TestCase):
|
||||
|
||||
def test_session_details(self):
|
||||
|
||||
group = GroupFactory.create(type_id='wg',state_id='active')
|
||||
session = SessionFactory.create(meeting__type_id='ietf',group=group, meeting__date=datetime.date.today()+datetime.timedelta(days=90))
|
||||
SessionPresentationFactory.create(session=session,document__type_id='draft',rev=None)
|
||||
SessionPresentationFactory.create(session=session,document__type_id='minutes')
|
||||
SessionPresentationFactory.create(session=session,document__type_id='slides')
|
||||
SessionPresentationFactory.create(session=session,document__type_id='agenda')
|
||||
|
||||
url = urlreverse("ietf.meeting.views.session_details", kwargs=dict(num=session.meeting.number, acronym=group.acronym))
|
||||
r = self.client.get(url)
|
||||
self.assertTrue(all([x in unicontent(r) for x in ('slides','agenda','minutes','draft')]))
|
||||
self.assertFalse('deleted' in unicontent(r))
|
||||
|
||||
|
|
|
@ -33,7 +33,12 @@
|
|||
{% if pres.document.type_id != 'bluesheets' and pres.document.type_id != 'recording' %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'doc_view' name=pres.document.name rev=pres.rev%}">{{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }})
|
||||
{% if pres.rev %}
|
||||
{% url 'doc_view' name=pres.document.name rev=pres.rev as url %}
|
||||
{% else %}
|
||||
{% url 'doc_view' name=pres.document.name as url %}
|
||||
{% endif %}
|
||||
<a href="{{url}}">{{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }})
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue