-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest_start_stream.py
More file actions
50 lines (39 loc) · 1.8 KB
/
test_start_stream.py
File metadata and controls
50 lines (39 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
test_start_stream.py
Unit tests for the <StartStream> BXML verb
@copyright Bandwidth Inc.
"""
import unittest
from bandwidth.models.bxml import StartStream, StreamParam, Verb, NestableVerb
class TestStartStream(unittest.TestCase):
def setUp(self):
self.stream_param1 = StreamParam(
name="name1",
value="value1"
)
self.stream_param2 = StreamParam(
name="name2",
value="value2"
)
self.start_stream = StartStream(
stream_params=[self.stream_param1],
name = "stream1",
mode = "bidirectional",
tracks = "inbound",
destination = "testurl.com",
stream_event_url="eventurl.com",
stream_event_method= "POST",
username = "user",
password = "pass"
)
def test_instance(self):
assert isinstance(self.start_stream, StartStream)
assert isinstance(self.start_stream, NestableVerb)
assert isinstance(self.start_stream, Verb)
def test_to_bxml(self):
expected = '<StartStream destination="testurl.com" name="stream1" mode="bidirectional" tracks="inbound" streamEventUrl="eventurl.com" streamEventMethod="POST" username="user" password="pass"><StreamParam name="name1" value="value1" /></StartStream>'
assert expected == self.start_stream.to_bxml()
def test_add_verb(self):
expected = '<StartStream destination="testurl.com" name="stream1" mode="bidirectional" tracks="inbound" streamEventUrl="eventurl.com" streamEventMethod="POST" username="user" password="pass"><StreamParam name="name1" value="value1" /><StreamParam name="name2" value="value2" /></StartStream>'
self.start_stream.add_verb(self.stream_param2)
assert expected == self.start_stream.to_bxml()