Skip to content

Commit ef1634e

Browse files
DX-2899
1 parent 5ad427c commit ef1634e

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
pause.py
3+
Bandwidth's Pause BXML verb
4+
@copyright Bandwidth INC
5+
"""
6+
from ..verb import Verb
7+
class Pause(Verb):
8+
def __init__(self, duration:str=None):
9+
"""Initialize a <Pause> verb
10+
Args:
11+
duration (str, optional): The time in seconds to pause. Default value is 1.
12+
"""
13+
self.attributes = {
14+
"duration": duration
15+
}
16+
17+
super().__init__(tag="Pause", content=None, attributes=self.attributes, nested_verbs=None)
18+
19+
def add_verb(self, verb: Verb):
20+
"""Adding verbs is not allowed for <Pause>
21+
Args:
22+
verb (Verb): BXML verb
23+
Raises:
24+
AttributeError: This method is not allowed for <Pause>
25+
"""
26+
raise AttributeError('Adding verbs is not supported by <Pause>')

test/unit/bxml/test_pause.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
test_Pause.py
3+
4+
Unit tests for the <PhoneNumber> BXML verb
5+
6+
@copyright Bandwidth Inc.
7+
"""
8+
import pytest
9+
import unittest
10+
11+
from bandwidth.model.bxml.verbs.pause import Pause
12+
13+
class TestPause(unittest.TestCase):
14+
15+
def setUp(self):
16+
self.pause = Pause(duration="30")
17+
18+
def test_to_bxml(self):
19+
expected = '<Pause duration="30" />'
20+
assert(expected == self.pause.to_bxml())
21+
22+
def test_add_verb(self):
23+
with pytest.raises(AttributeError):
24+
self.pause.add_verb(self.test_verb)

0 commit comments

Comments
 (0)