Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrice6713 committed Nov 14, 2023
1 parent 2758637 commit 00e4016
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bandwidth/models/bxml/verbs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .bridge import Bridge
from .conference import Conference
from .custom_param import CustomParam
from .hangup import Hangup
from .gather import Gather
from .pause import Pause
Expand All @@ -16,9 +17,11 @@
from .start_gather import StartGather
from .start_recording import StartRecording
from .start_stream import StartStream
from .start_transcription import StartTranscription
from .stop_gather import StopGather
from .stop_stream import StopStream
from .stop_recording import StopRecording
from .stop_transcription import StopTranscription
from .stream_param import StreamParam
from .tag import Tag
from .transfer import Transfer
44 changes: 44 additions & 0 deletions test/unit/bxml/test_start_transcription.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""
test_start_transcription.py
Unit tests for the <StartTranscription> BXML verb
@copyright Bandwidth Inc.
"""
import unittest

from bandwidth.models.bxml import StartTranscription, CustomParam


class TestStartTranscription(unittest.TestCase):
def setUp(self) -> None:
self.custom_param1 = CustomParam(
name="name1",
value="value1"
)

self.custom_param2 = CustomParam(
name="name2",
value="value2"
)

self.start_transcription = StartTranscription(
name="transcription1",
tracks="both",
transcription_event_url="eventurl.com",
transcription_event_method="POST",
username="user",
password="pass",
destination="testurl.com",
stabilized=True,
custom_params=[self.custom_param1]
)

def test_to_bxml(self):
expected = '<StartTranscription destination="testurl.com" name="transcription1" tracks="both" transcriptionEventUrl="eventurl.com" transcriptionEventMethod="POST" username="user" password="pass" stabilized="true"><CustomParam name="name1" value="value1" /></StartTranscription>'
assert(expected == self.start_transcription.to_bxml())

def test_add_verb(self):
expected = '<StartTranscription destination="testurl.com" name="transcription1" tracks="both" transcriptionEventUrl="eventurl.com" transcriptionEventMethod="POST" username="user" password="pass" stabilized="true"><CustomParam name="name1" value="value1" /><CustomParam name="name2" value="value2" /></StartTranscription>'
self.start_transcription.add_verb(self.custom_param2)
assert(expected == self.start_transcription.to_bxml())
21 changes: 21 additions & 0 deletions test/unit/bxml/test_stop_transcription.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
test_stop_transcription.py
Unit tests for the <StopTranscription> BXML verb
@copyright Bandwidth Inc.
"""
import unittest

from bandwidth.models.bxml import StopTranscription


class TestStopTranscription(unittest.TestCase):
def setUp(self) -> None:
self.stop_transcription = StopTranscription(
name="transcription1"
)

def test_to_bxml(self):
expected = '<StopTranscription name="transcription1" />'
assert(expected == StopTranscription().to_bxml())

0 comments on commit 00e4016

Please sign in to comment.