Skip to content

Commit b13532e

Browse files
committed
added new test for broadcast HLS mutually exclusive options, cleaned up other tests
1 parent 19f4342 commit b13532e

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

tests/test_broadcast.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from six import u, PY2, PY3
99
from expects import *
1010
from opentok import Client, Broadcast, __version__, BroadcastError
11+
from opentok.exceptions import BroadcastHLSOptionsError
1112
from .validate_jwt import validate_jwt_header
1213

1314

@@ -653,3 +654,38 @@ def test_set_broadcast_layout_throws_exception(self):
653654
broadcast_id,
654655
"horizontalPresentation",
655656
)
657+
658+
def test_broadcast_hls_mutually_exclusive_options_error(self):
659+
"""
660+
Test invalid options in start_broadcast() method raises a BroadcastHLSOptionsError.
661+
"""
662+
663+
options = {
664+
"layout": {
665+
"type": "custom",
666+
"stylesheet": "the layout stylesheet (only used with type == custom)",
667+
},
668+
"maxDuration": 5400,
669+
"outputs": {
670+
"hls": {
671+
"lowLatency": True,
672+
"dvr": True
673+
},
674+
"rtmp": [
675+
{
676+
"id": "foo",
677+
"serverUrl": "rtmp://myfooserver/myfooapp",
678+
"streamName": "myfoostream",
679+
},
680+
{
681+
"id": "bar",
682+
"serverUrl": "rtmp://mybarserver/mybarapp",
683+
"streamName": "mybarstream",
684+
},
685+
],
686+
},
687+
"resolution": "640x480",
688+
}
689+
690+
with self.assertRaises(BroadcastHLSOptionsError):
691+
self.opentok.start_broadcast(self.session_id, options)

tests/test_custom_jwt_claims.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from nose.tools import raises
44
from expects import *
55

6-
from opentok import OpenTok, __version__
6+
from opentok import Client, __version__
77
import time
88
from jose import jwt
99

@@ -15,7 +15,7 @@ def setUp(self):
1515
self.session_id = u(
1616
"1_MX4xMjM0NTZ-flNhdCBNYXIgMTUgMTQ6NDI6MjMgUERUIDIwMTR-MC40OTAxMzAyNX4"
1717
)
18-
self.opentok = OpenTok(self.api_key, self.api_secret)
18+
self.opentok = Client(self.api_key, self.api_secret)
1919

2020
def test_livetime_custom_claim(self):
2121
self.opentok.jwt_livetime = 5 # Token will expire 5 minutes in the future

tests/test_opentok.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
import unittest
2-
from requests.models import Response
3-
4-
from six import text_type, u, b, PY2, PY3
5-
from nose.tools import raises
62

73
import requests
84
import httpretty
9-
from sure import expect
105
import random
116
import string
127

13-
import json
14-
15-
import opentok
16-
from opentok import Client, OpenTok
8+
from opentok import Client
179

1810

1911
class OpenTokTest(unittest.TestCase):

0 commit comments

Comments
 (0)