Skip to content

Commit 44bb285

Browse files
jimfentonrjsparks
andauthored
fix: use correct variable to decide to show meeting notes (ietf-tools#8674)
* fix: use correct variable to decide to show session notes * Correct number of lines for selftests * fix: adjust test to match --------- Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
1 parent 4bf1b93 commit 44bb285

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

ietf/meeting/tests_views.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -424,37 +424,41 @@ def test_meeting_agenda(self):
424424
self.assertEqual(r.status_code, 200)
425425

426426
def test_session_recordings_via_factories(self):
427-
session = SessionFactory(meeting__type_id="ietf", meeting__date=date_today()-datetime.timedelta(days=180))
427+
session = SessionFactory(meeting__type_id="ietf", meeting__date=date_today()-datetime.timedelta(days=180), meeting__number=str(random.randint(108,150)))
428428
self.assertEqual(session.meetecho_recording_name, "")
429429
self.assertEqual(len(session.recordings()), 0)
430430
url = urlreverse("ietf.meeting.views.session_details", kwargs=dict(num=session.meeting.number, acronym=session.group.acronym))
431431
r = self.client.get(url)
432432
q = PyQuery(r.content)
433433
# debug.show("q(f'#notes_and_recordings_{session.pk}')")
434-
self.assertEqual(len(q(f"#notes_and_recordings_{session.pk} tr")), 1)
435-
link = q(f"#notes_and_recordings_{session.pk} tr a")
436-
self.assertEqual(len(link), 1)
437-
self.assertEqual(link[0].attrib['href'], str(session.session_recording_url()))
434+
self.assertEqual(len(q(f"#notes_and_recordings_{session.pk} tr")), 2)
435+
links = q(f"#notes_and_recordings_{session.pk} tr a")
436+
self.assertEqual(len(links), 2)
437+
self.assertEqual(links[0].attrib['href'], str(session.notes_url()))
438+
self.assertEqual(links[1].attrib['href'], str(session.session_recording_url()))
438439

439440
session.meetecho_recording_name = 'my_test_session_name'
440441
session.save()
441442
r = self.client.get(url)
442443
q = PyQuery(r.content)
443-
self.assertEqual(len(q(f"#notes_and_recordings_{session.pk} tr")), 1)
444+
self.assertEqual(len(q(f"#notes_and_recordings_{session.pk} tr")), 2)
444445
links = q(f"#notes_and_recordings_{session.pk} tr a")
445-
self.assertEqual(len(links), 1)
446-
self.assertEqual(links[0].attrib['href'], session.session_recording_url())
446+
self.assertEqual(len(links), 2)
447+
self.assertEqual(links[0].attrib['href'], str(session.notes_url()))
448+
self.assertEqual(links[1].attrib['href'], str(session.session_recording_url()))
447449

448450
new_recording_url = "https://www.youtube.com/watch?v=jNQXAC9IVRw"
449451
new_recording_title = "Me at the zoo"
450452
create_recording(session, new_recording_url, new_recording_title)
451453
r = self.client.get(url)
452454
q = PyQuery(r.content)
453-
self.assertEqual(len(q(f"#notes_and_recordings_{session.pk} tr")), 2)
455+
self.assertEqual(len(q(f"#notes_and_recordings_{session.pk} tr")), 3)
454456
links = q(f"#notes_and_recordings_{session.pk} tr a")
455-
self.assertEqual(len(links), 2)
456-
self.assertEqual(links[0].attrib['href'], new_recording_url)
457-
self.assertIn(new_recording_title, links[0].text_content())
457+
self.assertEqual(len(links), 3)
458+
self.assertEqual(links[0].attrib['href'], str(session.notes_url()))
459+
self.assertEqual(links[1].attrib['href'], new_recording_url)
460+
self.assertIn(new_recording_title, links[1].text_content())
461+
self.assertEqual(links[2].attrib['href'], str(session.session_recording_url()))
458462
#debug.show("q(f'#notes_and_recordings_{session_pk}')")
459463

460464
def test_delete_recordings(self):

ietf/templates/meeting/session_details_panel.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ <h3 class="mt-4">Notes and recordings</h3>
310310
<table class="table table-sm table-striped meeting-tools"
311311
id="notes_and_recordings_{{ session.pk }}">
312312
<tbody>
313-
{% if session.uses_notes %}
313+
{% if meeting.uses_notes %}
314314
<tr>
315315
<td>
316316
<a href="{{ session.notes_url }}">

0 commit comments

Comments
 (0)