@@ -24,27 +24,27 @@ def test_create_default_session(self):
24
24
25
25
expect (httpretty .last_request ().headers [u ('x-tb-partner-auth' )]).to .equal (self .api_key + u (':' )+ self .api_secret )
26
26
expect (httpretty .last_request ().headers [u ('user-agent' )]).to .contain (u ('OpenTok-Python-SDK/' )+ __version__ )
27
- expect (httpretty .last_request ().body ).to .equal (b ('p2p.preference=disabled ' ))
27
+ expect (httpretty .last_request ().body ).to .equal (b ('p2p.preference=enabled ' ))
28
28
expect (session ).to .be .a (Session )
29
29
expect (session ).to .have .property (u ('session_id' )).being .equal (u ('1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg' ))
30
- expect (session ).to .have .property (u ('media_mode' )).being .equal (MediaModes .routed )
30
+ expect (session ).to .have .property (u ('media_mode' )).being .equal (MediaModes .relayed )
31
31
expect (session ).to .have .property (u ('location' )).being .equal (None )
32
32
33
33
@httpretty .activate
34
- def test_create_p2p_session (self ):
34
+ def test_create_routed_session (self ):
35
35
httpretty .register_uri (httpretty .POST , u ('https://api.opentok.com/session/create' ),
36
36
body = u ('<?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>' ),
37
37
status = 200 ,
38
38
content_type = u ('text/xml' ))
39
39
40
- session = self .opentok .create_session (media_mode = MediaModes .relayed )
40
+ session = self .opentok .create_session (media_mode = MediaModes .routed )
41
41
42
42
expect (httpretty .last_request ().headers [u ('x-tb-partner-auth' )]).to .equal (self .api_key + u (':' )+ self .api_secret )
43
43
expect (httpretty .last_request ().headers [u ('user-agent' )]).to .contain (u ('OpenTok-Python-SDK/' )+ __version__ )
44
- expect (httpretty .last_request ().body ).to .equal (b ('p2p.preference=enabled ' ))
44
+ expect (httpretty .last_request ().body ).to .equal (b ('p2p.preference=disabled ' ))
45
45
expect (session ).to .be .a (Session )
46
46
expect (session ).to .have .property (u ('session_id' )).being .equal (u ('1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg' ))
47
- expect (session ).to .have .property (u ('media_mode' )).being .equal (MediaModes .relayed )
47
+ expect (session ).to .have .property (u ('media_mode' )).being .equal (MediaModes .routed )
48
48
expect (session ).to .have .property (u ('location' )).being .equal (None )
49
49
50
50
@httpretty .activate
@@ -61,30 +61,30 @@ def test_create_session_with_location_hint(self):
61
61
# ordering of keys is non-deterministic, must parse the body to see if it is correct
62
62
body = parse_qs (httpretty .last_request ().body )
63
63
expect (body ).to .have .key (b ('location' )).being .equal ([b ('12.34.56.78' )])
64
- expect (body ).to .have .key (b ('p2p.preference' )).being .equal ([b ('disabled ' )])
64
+ expect (body ).to .have .key (b ('p2p.preference' )).being .equal ([b ('enabled ' )])
65
65
expect (session ).to .be .a (Session )
66
66
expect (session ).to .have .property (u ('session_id' )).being .equal (u ('1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg' ))
67
- expect (session ).to .have .property (u ('media_mode' )).being .equal (MediaModes .routed )
67
+ expect (session ).to .have .property (u ('media_mode' )).being .equal (MediaModes .relayed )
68
68
expect (session ).to .have .property (u ('location' )).being .equal (u ('12.34.56.78' ))
69
69
70
70
@httpretty .activate
71
- def test_create_p2p_session_with_location_hint (self ):
71
+ def test_create_routed_session_with_location_hint (self ):
72
72
httpretty .register_uri (httpretty .POST , u ('https://api.opentok.com/session/create' ),
73
73
body = u ('<?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>' ),
74
74
status = 200 ,
75
75
content_type = u ('text/xml' ))
76
76
77
- session = self .opentok .create_session (location = '12.34.56.78' , media_mode = MediaModes .relayed )
77
+ session = self .opentok .create_session (location = '12.34.56.78' , media_mode = MediaModes .routed )
78
78
79
79
expect (httpretty .last_request ().headers [u ('x-tb-partner-auth' )]).to .equal (self .api_key + u (':' )+ self .api_secret )
80
80
expect (httpretty .last_request ().headers [u ('user-agent' )]).to .contain (u ('OpenTok-Python-SDK/' )+ __version__ )
81
81
# ordering of keys is non-deterministic, must parse the body to see if it is correct
82
82
body = parse_qs (httpretty .last_request ().body )
83
83
expect (body ).to .have .key (b ('location' )).being .equal ([b ('12.34.56.78' )])
84
- expect (body ).to .have .key (b ('p2p.preference' )).being .equal ([b ('enabled ' )])
84
+ expect (body ).to .have .key (b ('p2p.preference' )).being .equal ([b ('disabled ' )])
85
85
expect (session ).to .be .a (Session )
86
86
expect (session ).to .have .property (u ('session_id' )).being .equal (u ('1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg' ))
87
- expect (session ).to .have .property (u ('media_mode' )).being .equal (MediaModes .relayed )
87
+ expect (session ).to .have .property (u ('media_mode' )).being .equal (MediaModes .routed )
88
88
expect (session ).to .have .property (u ('location' )).being .equal (u ('12.34.56.78' ))
89
89
90
90
# TODO: all the cases that throw exceptions
0 commit comments