@@ -104,7 +104,7 @@ def test_edit(self):
104104 'joint_with_groups' : group3 .acronym + ' ' + group4 .acronym ,
105105 'joint_for_session' : '2' ,
106106 'timeranges' : ['thursday-afternoon-early' , 'thursday-afternoon-late' ],
107- 'session_set-TOTAL_FORMS' : '2' ,
107+ 'session_set-TOTAL_FORMS' : '3' , # matches what view actually sends, even with only 2 filled in
108108 'session_set-INITIAL_FORMS' : '1' ,
109109 'session_set-MIN_NUM_FORMS' : '1' ,
110110 'session_set-MAX_NUM_FORMS' : '3' ,
@@ -130,6 +130,16 @@ def test_edit(self):
130130 'session_set-1-attendees' : attendees ,
131131 'session_set-1-comments' : comments ,
132132 'session_set-1-DELETE' : '' ,
133+ 'session_set-2-id' : '' ,
134+ 'session_set-2-name' : '' ,
135+ 'session_set-2-short' : '' ,
136+ 'session_set-2-purpose' : 'regular' ,
137+ 'session_set-2-type' : 'regular' ,
138+ 'session_set-2-requested_duration' : '' ,
139+ 'session_set-2-on_agenda' : 'True' ,
140+ 'session_set-2-attendees' : attendees ,
141+ 'session_set-2-comments' : '' ,
142+ 'session_set-2-DELETE' : 'on' ,
133143 'submit' : 'Continue' }
134144 r = self .client .post (url , post_data , HTTP_HOST = 'example.com' )
135145 redirect_url = reverse ('ietf.secr.sreq.views.view' , kwargs = {'acronym' : 'mars' })
@@ -172,7 +182,7 @@ def test_edit(self):
172182 'comments' :'need lights' ,
173183 'joint_with_groups' : group2 .acronym ,
174184 'joint_for_session' : '1' ,
175- 'session_set-TOTAL_FORMS' : '2' ,
185+ 'session_set-TOTAL_FORMS' : '3' , # matches what view actually sends, even with only 2 filled in
176186 'session_set-INITIAL_FORMS' : '2' ,
177187 'session_set-MIN_NUM_FORMS' : '1' ,
178188 'session_set-MAX_NUM_FORMS' : '3' ,
@@ -198,6 +208,16 @@ def test_edit(self):
198208 'session_set-1-attendees' : sessions [1 ].attendees ,
199209 'session_set-1-comments' : sessions [1 ].comments ,
200210 'session_set-1-DELETE' : '' ,
211+ 'session_set-2-id' : '' ,
212+ 'session_set-2-name' : '' ,
213+ 'session_set-2-short' : '' ,
214+ 'session_set-2-purpose' : 'regular' ,
215+ 'session_set-2-type' : 'regular' ,
216+ 'session_set-2-requested_duration' : '' ,
217+ 'session_set-2-on_agenda' : 'True' ,
218+ 'session_set-2-attendees' : attendees ,
219+ 'session_set-2-comments' : '' ,
220+ 'session_set-2-DELETE' : 'on' ,
201221 'submit' : 'Continue' }
202222 r = self .client .post (url , post_data , HTTP_HOST = 'example.com' )
203223 self .assertRedirects (r , redirect_url )
@@ -222,6 +242,74 @@ def test_edit(self):
222242 r = self .client .get (redirect_url )
223243 self .assertContains (r , 'First session with: {}' .format (group2 .acronym ))
224244
245+
246+ @override_settings (SECR_VIRTUAL_MEETINGS = tuple ()) # ensure not unexpectedly testing a virtual meeting session
247+ def test_edit_constraint_bethere (self ):
248+ meeting = MeetingFactory (type_id = 'ietf' , date = datetime .date .today ())
249+ mars = RoleFactory (name_id = 'chair' , person__user__username = 'marschairman' , group__acronym = 'mars' ).group
250+ session = SessionFactory (meeting = meeting , group = mars , status_id = 'sched' )
251+ Constraint .objects .create (
252+ meeting = meeting ,
253+ source = mars ,
254+ person = Person .objects .get (user__username = 'marschairman' ),
255+ name_id = 'bethere' ,
256+ )
257+ self .assertEqual (session .people_constraints .count (), 1 )
258+ url = reverse ('ietf.secr.sreq.views.edit' , kwargs = dict (acronym = 'mars' ))
259+ self .client .login (username = 'marschairman' , password = 'marschairman+password' )
260+ attendees = '10'
261+ ad = Person .objects .get (user__username = 'ad' )
262+ post_data = {
263+ 'num_session' : '1' ,
264+ 'attendees' : attendees ,
265+ 'bethere' : str (ad .pk ),
266+ 'constraint_chair_conflict' :'' ,
267+ 'comments' :'' ,
268+ 'joint_with_groups' : '' ,
269+ 'joint_for_session' : '' ,
270+ 'delete_conflict' : 'on' ,
271+ 'session_set-TOTAL_FORMS' : '3' , # matches what view actually sends, even with only 2 filled in
272+ 'session_set-INITIAL_FORMS' : '1' ,
273+ 'session_set-MIN_NUM_FORMS' : '1' ,
274+ 'session_set-MAX_NUM_FORMS' : '3' ,
275+ 'session_set-0-id' :session .pk ,
276+ 'session_set-0-name' : session .name ,
277+ 'session_set-0-short' : session .short ,
278+ 'session_set-0-purpose' : session .purpose_id ,
279+ 'session_set-0-type' : session .type_id ,
280+ 'session_set-0-requested_duration' : '3600' ,
281+ 'session_set-0-on_agenda' : session .on_agenda ,
282+ 'session_set-0-remote_instructions' : session .remote_instructions ,
283+ 'session_set-0-attendees' : attendees ,
284+ 'session_set-0-comments' : '' ,
285+ 'session_set-0-DELETE' : '' ,
286+ 'session_set-1-id' : '' ,
287+ 'session_set-1-name' : '' ,
288+ 'session_set-1-short' : '' ,
289+ 'session_set-1-purpose' :'regular' ,
290+ 'session_set-1-type' :'regular' ,
291+ 'session_set-1-requested_duration' : '' ,
292+ 'session_set-1-on_agenda' : 'True' ,
293+ 'session_set-1-attendees' : attendees ,
294+ 'session_set-1-comments' : '' ,
295+ 'session_set-1-DELETE' : 'on' ,
296+ 'session_set-2-id' : '' ,
297+ 'session_set-2-name' : '' ,
298+ 'session_set-2-short' : '' ,
299+ 'session_set-2-purpose' : 'regular' ,
300+ 'session_set-2-type' : 'regular' ,
301+ 'session_set-2-requested_duration' : '' ,
302+ 'session_set-2-on_agenda' : 'True' ,
303+ 'session_set-2-attendees' : attendees ,
304+ 'session_set-2-comments' : '' ,
305+ 'session_set-2-DELETE' : 'on' ,
306+ 'submit' : 'Save' ,
307+ }
308+ r = self .client .post (url , post_data , HTTP_HOST = 'example.com' )
309+ redirect_url = reverse ('ietf.secr.sreq.views.view' , kwargs = {'acronym' : 'mars' })
310+ self .assertRedirects (r , redirect_url )
311+ self .assertEqual ([pc .person for pc in session .people_constraints .all ()], [ad ])
312+
225313 def test_edit_inactive_conflicts (self ):
226314 """Inactive conflicts should be displayed and removable"""
227315 meeting = MeetingFactory (type_id = 'ietf' , date = datetime .date .today (), group_conflicts = ['chair_conflict' ])
0 commit comments