|
9 | 9 |
|
10 | 10 | import debug # pyflakes:ignore |
11 | 11 |
|
| 12 | +from contextlib import closing |
| 13 | + |
12 | 14 | from django.urls import reverse as urlreverse |
13 | 15 | from django.conf import settings |
14 | 16 | from django.contrib.auth.models import User |
|
36 | 38 | from ietf.meeting.factories import ( SessionFactory, SessionPresentationFactory, ScheduleFactory, |
37 | 39 | MeetingFactory, FloorPlanFactory, TimeSlotFactory ) |
38 | 40 | from ietf.doc.factories import DocumentFactory |
| 41 | +from ietf.submit.tests import submission_file |
39 | 42 |
|
40 | 43 |
|
41 | 44 | class MeetingTests(TestCase): |
@@ -456,6 +459,35 @@ def test_group_ical(self): |
456 | 459 | self.assertNotContains(r, t2.time.strftime('%Y%m%dT%H%M%S')) |
457 | 460 | self.assertContains(r, 'END:VEVENT') |
458 | 461 |
|
| 462 | + def test_session_draft_tarfile(self): |
| 463 | + session = SessionFactory(group__type_id='wg',meeting__type_id='ietf') |
| 464 | + doc = DocumentFactory(type_id='draft') |
| 465 | + session.sessionpresentation_set.create(document=doc) |
| 466 | + file,_ = submission_file(name=doc.name,format='txt',templatename='test_submission.txt',group=session.group,rev="00") |
| 467 | + filename = os.path.join(doc.get_file_path(),file.name) |
| 468 | + with closing(open(filename,'w')) as draftbits: |
| 469 | + draftbits.write(file.getvalue()) |
| 470 | + |
| 471 | + url = urlreverse('ietf.meeting.views.session_draft_tarfile', kwargs={'num':session.meeting.number,'acronym':session.group.acronym}) |
| 472 | + response = self.client.get(url) |
| 473 | + self.assertEqual(response.status_code, 200) |
| 474 | + self.assertEqual(response.get('Content-Type'), 'application/octet-stream') |
| 475 | + os.unlink(filename) |
| 476 | + |
| 477 | + def test_session_draft_pdf(self): |
| 478 | + session = SessionFactory(group__type_id='wg',meeting__type_id='ietf') |
| 479 | + doc = DocumentFactory(type_id='draft') |
| 480 | + session.sessionpresentation_set.create(document=doc) |
| 481 | + file,_ = submission_file(name=doc.name,format='txt',templatename='test_submission.txt',group=session.group,rev="00") |
| 482 | + filename = os.path.join(doc.get_file_path(),file.name) |
| 483 | + with closing(open(filename,'w')) as draftbits: |
| 484 | + draftbits.write(file.getvalue()) |
| 485 | + |
| 486 | + url = urlreverse('ietf.meeting.views.session_draft_pdf', kwargs={'num':session.meeting.number,'acronym':session.group.acronym}) |
| 487 | + response = self.client.get(url) |
| 488 | + self.assertEqual(response.status_code, 200) |
| 489 | + self.assertEqual(response.get('Content-Type'), 'application/pdf') |
| 490 | + os.unlink(filename) |
459 | 491 |
|
460 | 492 |
|
461 | 493 | class EditTests(TestCase): |
|
0 commit comments