Skip to content

Commit 65ad8cc

Browse files
authored
Merge pull request #347 from twilio/voice-response-devx5022
Make url parameter optional
2 parents 81ad4b8 + d288b13 commit 65ad8cc

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

tests/unit/twiml/test_voice_response.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class TestPlay(TwilioTest):
120120
def test_empty_play(self):
121121
""" should play hello monkey """
122122
r = VoiceResponse()
123-
r.play('')
123+
r.play()
124124

125125
assert_equal(
126126
self.strip(r),
@@ -130,7 +130,7 @@ def test_empty_play(self):
130130
def test_play_hello(self):
131131
""" should play hello monkey """
132132
r = VoiceResponse()
133-
r.play('http://hellomonkey.mp3')
133+
r.play(url='http://hellomonkey.mp3')
134134

135135
assert_equal(
136136
self.strip(r),
@@ -140,7 +140,7 @@ def test_play_hello(self):
140140
def test_play_hello_loop(self):
141141
""" should play hello monkey loop """
142142
r = VoiceResponse()
143-
r.play('http://hellomonkey.mp3', loop=3)
143+
r.play(url='http://hellomonkey.mp3', loop=3)
144144

145145
assert_equal(
146146
self.strip(r),
@@ -150,7 +150,7 @@ def test_play_hello_loop(self):
150150
def test_play_digits(self):
151151
""" should play digits """
152152
r = VoiceResponse()
153-
r.play('', digits='w123')
153+
r.play(digits='w123')
154154

155155
assert_equal(
156156
self.strip(r),
@@ -579,7 +579,7 @@ def test_nested_say_play_pause(self):
579579
""" a gather with a say, play, and pause """
580580
g = Gather()
581581
g.say('Hey')
582-
g.play('hey.mp3')
582+
g.play(url='hey.mp3')
583583
g.pause()
584584

585585
r = VoiceResponse()

twilio/twiml/voice_response.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def pause(self, length=None):
164164
return self.append(Pause(length=length))
165165

166166
def play(self,
167-
url,
167+
url=None,
168168
loop=None,
169169
digits=None,
170170
**kwargs):
@@ -178,7 +178,7 @@ def play(self,
178178
:return: <Play> element
179179
"""
180180
return self.append(Play(
181-
url,
181+
url=url,
182182
loop=loop,
183183
digits=digits,
184184
**kwargs
@@ -697,7 +697,7 @@ def say(self,
697697
))
698698

699699
def play(self,
700-
url,
700+
url=None,
701701
loop=None,
702702
digits=None,
703703
**kwargs):
@@ -711,7 +711,7 @@ def play(self,
711711
:return: <Play> element
712712
"""
713713
return self.append(Play(
714-
url,
714+
url=url,
715715
loop=loop,
716716
digits=digits,
717717
**kwargs
@@ -738,12 +738,12 @@ class Play(TwiML):
738738
"""
739739
<Play> element
740740
"""
741-
def __init__(self, url, **kwargs):
741+
def __init__(self, url=None, **kwargs):
742742
"""
743743
Create a new <Play> element
744744
745-
:param url: media URL
746-
:param kwargs: additional attributes
745+
:param url: optional media URL
746+
:param kwargs: attributes
747747
"""
748748
super(Play, self).__init__(**kwargs)
749749
self.value = url

0 commit comments

Comments
 (0)