|
25 | 25 | from ietf.meeting.helpers import send_interim_approval_request |
26 | 26 | from ietf.meeting.helpers import send_interim_cancellation_notice |
27 | 27 | from ietf.meeting.helpers import send_interim_minutes_reminder, populate_important_dates, update_important_dates |
28 | | -from ietf.meeting.models import Session, TimeSlot, Meeting, SchedTimeSessAssignment, Schedule, SessionPresentation |
| 28 | +from ietf.meeting.models import Session, TimeSlot, Meeting, SchedTimeSessAssignment, Schedule, SessionPresentation, SlideSubmission |
29 | 29 | from ietf.meeting.test_data import make_meeting_test_data, make_interim_meeting |
30 | 30 | from ietf.meeting.utils import finalize |
31 | 31 | from ietf.name.models import SessionStatusName, ImportantDateName |
|
34 | 34 | from ietf.utils.text import xslugify |
35 | 35 |
|
36 | 36 | from ietf.person.factories import PersonFactory |
37 | | -from ietf.group.factories import GroupFactory, GroupEventFactory |
| 37 | +from ietf.group.factories import GroupFactory, GroupEventFactory, RoleFactory |
38 | 38 | from ietf.meeting.factories import ( SessionFactory, SessionPresentationFactory, ScheduleFactory, |
39 | | - MeetingFactory, FloorPlanFactory, TimeSlotFactory ) |
| 39 | + MeetingFactory, FloorPlanFactory, TimeSlotFactory, SlideSubmissionFactory ) |
40 | 40 | from ietf.doc.factories import DocumentFactory |
41 | 41 | from ietf.submit.tests import submission_file |
42 | 42 |
|
@@ -2007,6 +2007,116 @@ def test_remove_sessionpresentation(self): |
2007 | 2007 | self.assertEqual(0,session.sessionpresentation_set.count()) |
2008 | 2008 | self.assertEqual(2,doc.docevent_set.count()) |
2009 | 2009 |
|
| 2010 | + def test_propose_session_slides(self): |
| 2011 | + for type_id in ['ietf','interim']: |
| 2012 | + session = SessionFactory(meeting__type_id=type_id) |
| 2013 | + chair = RoleFactory(group=session.group,name_id='chair').person |
| 2014 | + session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) |
| 2015 | + newperson = PersonFactory() |
| 2016 | + |
| 2017 | + session_overview_url = urlreverse('ietf.meeting.views.session_details',kwargs={'num':session.meeting.number,'acronym':session.group.acronym}) |
| 2018 | + propose_url = urlreverse('ietf.meeting.views.propose_session_slides', kwargs={'session_id':session.pk, 'num': session.meeting.number}) |
| 2019 | + |
| 2020 | + r = self.client.get(session_overview_url) |
| 2021 | + self.assertEqual(r.status_code,200) |
| 2022 | + q = PyQuery(r.content) |
| 2023 | + self.assertFalse(q('#uploadslides')) |
| 2024 | + self.assertFalse(q('#proposeslides')) |
| 2025 | + |
| 2026 | + self.client.login(username=newperson.user.username,password=newperson.user.username+"+password") |
| 2027 | + r = self.client.get(session_overview_url) |
| 2028 | + self.assertEqual(r.status_code,200) |
| 2029 | + q = PyQuery(r.content) |
| 2030 | + self.assertTrue(q('#proposeslides')) |
| 2031 | + self.client.logout() |
| 2032 | + |
| 2033 | + login_testing_unauthorized(self,newperson.user.username,propose_url) |
| 2034 | + r = self.client.get(propose_url) |
| 2035 | + self.assertEqual(r.status_code,200) |
| 2036 | + test_file = StringIO('this is not really a slide') |
| 2037 | + test_file.name = 'not_really.txt' |
| 2038 | + empty_outbox() |
| 2039 | + r = self.client.post(propose_url,dict(file=test_file,title='a test slide file',apply_to_all=True)) |
| 2040 | + self.assertEqual(r.status_code, 302) |
| 2041 | + session = Session.objects.get(pk=session.pk) |
| 2042 | + self.assertEqual(session.slidesubmission_set.count(),1) |
| 2043 | + self.assertEqual(len(outbox),1) |
| 2044 | + |
| 2045 | + r = self.client.get(session_overview_url) |
| 2046 | + self.assertEqual(r.status_code, 200) |
| 2047 | + q = PyQuery(r.content) |
| 2048 | + self.assertEqual(len(q('#proposedslidelist p')), 1) |
| 2049 | + |
| 2050 | + SlideSubmissionFactory(session = session) |
| 2051 | + |
| 2052 | + self.client.logout() |
| 2053 | + self.client.login(username=chair.user.username, password=chair.user.username+"+password") |
| 2054 | + r = self.client.get(session_overview_url) |
| 2055 | + self.assertEqual(r.status_code, 200) |
| 2056 | + q = PyQuery(r.content) |
| 2057 | + self.assertEqual(len(q('#proposedslidelist p')), 2) |
| 2058 | + self.client.logout() |
| 2059 | + |
| 2060 | + def test_disapprove_proposed_slides(self): |
| 2061 | + submission = SlideSubmissionFactory() |
| 2062 | + submission.session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) |
| 2063 | + chair = RoleFactory(group=submission.session.group,name_id='chair').person |
| 2064 | + url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) |
| 2065 | + login_testing_unauthorized(self, chair.user.username, url) |
| 2066 | + r = self.client.get(url) |
| 2067 | + self.assertEqual(r.status_code,200) |
| 2068 | + r = self.client.post(url,dict(title='some title',disapprove="disapprove")) |
| 2069 | + self.assertEqual(r.status_code,302) |
| 2070 | + self.assertEqual(SlideSubmission.objects.count(), 0) |
| 2071 | + |
| 2072 | + def test_approve_proposed_slides(self): |
| 2073 | + submission = SlideSubmissionFactory() |
| 2074 | + session = submission.session |
| 2075 | + session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) |
| 2076 | + chair = RoleFactory(group=submission.session.group,name_id='chair').person |
| 2077 | + url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) |
| 2078 | + login_testing_unauthorized(self, chair.user.username, url) |
| 2079 | + r = self.client.get(url) |
| 2080 | + self.assertEqual(r.status_code,200) |
| 2081 | + r = self.client.post(url,dict(title='different title',approve='approve')) |
| 2082 | + self.assertEqual(r.status_code,302) |
| 2083 | + self.assertEqual(SlideSubmission.objects.count(), 0) |
| 2084 | + self.assertEqual(session.sessionpresentation_set.count(),1) |
| 2085 | + self.assertEqual(session.sessionpresentation_set.first().document.title,'different title') |
| 2086 | + |
| 2087 | + def test_approve_proposed_slides_multisession_apply_one(self): |
| 2088 | + submission = SlideSubmissionFactory(session__meeting__type_id='ietf') |
| 2089 | + session1 = submission.session |
| 2090 | + session2 = SessionFactory(group=submission.session.group, meeting=submission.session.meeting) |
| 2091 | + submission.session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) |
| 2092 | + chair = RoleFactory(group=submission.session.group,name_id='chair').person |
| 2093 | + url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) |
| 2094 | + login_testing_unauthorized(self, chair.user.username, url) |
| 2095 | + r = self.client.get(url) |
| 2096 | + self.assertEqual(r.status_code,200) |
| 2097 | + q = PyQuery(r.content) |
| 2098 | + self.assertTrue(q('#id_apply_to_all')) |
| 2099 | + r = self.client.post(url,dict(title='yet another title',approve='approve')) |
| 2100 | + self.assertEqual(r.status_code,302) |
| 2101 | + self.assertEqual(session1.sessionpresentation_set.count(),1) |
| 2102 | + self.assertEqual(session2.sessionpresentation_set.count(),0) |
| 2103 | + |
| 2104 | + def test_approve_proposed_slides_multisession_apply_all(self): |
| 2105 | + submission = SlideSubmissionFactory(session__meeting__type_id='ietf') |
| 2106 | + session1 = submission.session |
| 2107 | + session2 = SessionFactory(group=submission.session.group, meeting=submission.session.meeting) |
| 2108 | + submission.session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) |
| 2109 | + chair = RoleFactory(group=submission.session.group,name_id='chair').person |
| 2110 | + url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) |
| 2111 | + login_testing_unauthorized(self, chair.user.username, url) |
| 2112 | + r = self.client.get(url) |
| 2113 | + self.assertEqual(r.status_code,200) |
| 2114 | + r = self.client.post(url,dict(title='yet another title',apply_to_all=1,approve='approve')) |
| 2115 | + self.assertEqual(r.status_code,302) |
| 2116 | + self.assertEqual(session1.sessionpresentation_set.count(),1) |
| 2117 | + self.assertEqual(session2.sessionpresentation_set.count(),1) |
| 2118 | + |
| 2119 | + |
2010 | 2120 | class SessionTests(TestCase): |
2011 | 2121 |
|
2012 | 2122 | def test_meeting_requests(self): |
|
0 commit comments