@@ -229,7 +229,10 @@ def test_create_always_archive_mode_session(self):
229229 )
230230
231231 session = self .opentok .create_session (
232- media_mode = MediaModes .routed , archive_mode = ArchiveModes .always
232+ media_mode = MediaModes .routed ,
233+ archive_mode = ArchiveModes .always ,
234+ archive_name = "test_opentok_archive" ,
235+ archive_resolution = "1920x1080" ,
233236 )
234237
235238 validate_jwt_header (self , httpretty .last_request ().headers [u ("x-opentok-auth" )])
@@ -239,6 +242,8 @@ def test_create_always_archive_mode_session(self):
239242 body = parse_qs (httpretty .last_request ().body )
240243 expect (body ).to (have_key (b ("p2p.preference" ), [b ("disabled" )]))
241244 expect (body ).to (have_key (b ("archiveMode" ), [b ("always" )]))
245+ expect (body ).to (have_key (b ("archiveName" ), [b ("test_opentok_archive" )]))
246+ expect (body ).to (have_key (b ("archiveResolution" ), [b ("1920x1080" )]))
242247 expect (session ).to (be_a (Session ))
243248 expect (session ).to (
244249 have_property (
@@ -252,24 +257,44 @@ def test_create_always_archive_mode_session(self):
252257 expect (session ).to (have_property (u ("archive_mode" ), ArchiveModes .always ))
253258 expect (session ).to (have_property (u ("e2ee" ), False ))
254259
255- @httpretty .activate
256260 def test_complains_about_always_archive_mode_and_relayed_session (self ):
257- httpretty .register_uri (
258- httpretty .POST ,
259- u ("https://api.opentok.com/session/create" ),
260- body = u (
261- '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon Mar 17 00:41:31 PDT 2014</create_dt></Session></sessions>'
262- ),
263- status = 200 ,
264- content_type = u ("text/xml" ),
265- )
266261 self .assertRaises (
267262 OpenTokException ,
268263 self .opentok .create_session ,
269264 media_mode = MediaModes .relayed ,
270265 archive_mode = ArchiveModes .always ,
271266 )
272267
268+ def test_auto_archive_errors (self ):
269+ self .assertRaises (
270+ OpenTokException ,
271+ self .opentok .create_session ,
272+ media_mode = MediaModes .routed ,
273+ archive_mode = ArchiveModes .manual ,
274+ archive_name = "my_archive" ,
275+ )
276+ self .assertRaises (
277+ OpenTokException ,
278+ self .opentok .create_session ,
279+ media_mode = MediaModes .routed ,
280+ archive_mode = ArchiveModes .manual ,
281+ archive_resolution = "640x480" ,
282+ )
283+ self .assertRaises (
284+ OpenTokException ,
285+ self .opentok .create_session ,
286+ media_mode = MediaModes .routed ,
287+ archive_mode = ArchiveModes .always ,
288+ archive_name = "my_incredibly_long_name_that_is_definitely_going_to_be_over_the_80_character_limit_we_currently_impose" ,
289+ )
290+ self .assertRaises (
291+ OpenTokException ,
292+ self .opentok .create_session ,
293+ media_mode = MediaModes .routed ,
294+ archive_mode = ArchiveModes .always ,
295+ archive_resolution = "10x10" ,
296+ )
297+
273298 @httpretty .activate
274299 def test_create_session_with_e2ee (self ):
275300 httpretty .register_uri (
@@ -285,7 +310,7 @@ def test_create_session_with_e2ee(self):
285310 session = self .opentok .create_session (e2ee = True )
286311
287312 body = parse_qs (httpretty .last_request ().body )
288- expect (body ).to (have_key (b ("e2ee" ), [b' True' ]))
313+ expect (body ).to (have_key (b ("e2ee" ), [b" True" ]))
289314 expect (session ).to (be_a (Session ))
290315 expect (session ).to (
291316 have_property (
0 commit comments