Skip to content

Commit ea545ae

Browse files
Refactored to take into account new terminal verb
1 parent df14a89 commit ea545ae

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

bandwidth/model/bxml/verbs/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .bridge import Bridge
2+
from .forward import Forward
23
from .phone_number import PhoneNumber
34
from .sip_uri import SipUri
45
from .tag import Tag

bandwidth/model/bxml/verbs/forward.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
66
@copyright Bandwidth INC
77
"""
8-
from ..verb import Verb
8+
from ..terminal_verb import TerminalVerb
99

1010

11-
class Forward(Verb):
11+
class Forward(TerminalVerb):
1212

1313
def __init__(
1414
self, to: str=None, from_: str=None,
@@ -49,21 +49,10 @@ def __init__(
4949
self.attributes = {
5050
"to": to,
5151
"from_": from_,
52-
"callTimeout": call_timeout,
53-
"diversionTreatment": diversion_treatment,
54-
"diversionReason": diversion_reason,
52+
"call_timeout": call_timeout,
53+
"diversion_treatment": diversion_treatment,
54+
"diversion_reason": diversion_reason,
5555
"uui": uui,
5656
}
5757

58-
super().__init__(tag="Forward", content=None, attributes=self.attributes, nested_verbs=None)
59-
60-
def add_verb(self, verb: Verb):
61-
"""Adding verbs is not allowed for <Forward>
62-
63-
Args:
64-
verb (Verb): BXML verb
65-
66-
Raises:
67-
AttributeError: This method is not allowed for <Forward>
68-
"""
69-
raise AttributeError('Adding verbs is not supported by <Forward>')
58+
super().__init__(tag="Forward", content=None, attributes=self.attributes)

test/unit/bxml/test_forward.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def setUp(self):
2525

2626
def test_to_bxml(self):
2727
if os.environ['PYTHON_VERSION'] == '3.7':
28-
expected = '<Forward callTimeout="15" diversionReason="away" diversionTreatment="propagate" from_="19195554322" to="19195554321" uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt" />'
28+
expected = '<Forward call_timeout="15" diversion_reason="away" diversion_treatment="propagate" from_="19195554322" to="19195554321" uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt" />'
2929
else:
30-
expected = '<Forward to="19195554321" from_="19195554322" callTimeout="15" diversionTreatment="propagate" diversionReason="away" uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt" />'
30+
expected = '<Forward to="19195554321" from_="19195554322" call_timeout="15" diversion_treatment="propagate" diversion_reason="away" uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt" />'
3131
assert(expected == self.forward.to_bxml())
3232

3333
def test_add_verb(self):

0 commit comments

Comments
 (0)