@@ -26,7 +26,8 @@ def test_response(self):
26
26
27
27
assert_equal (
28
28
self .strip (r ),
29
- '<?xml version="1.0" encoding="UTF-8"?><Response><Hangup /><Leave /><Sms from="+10987654321" to="+11234567890">twilio sms</Sms></Response>'
29
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Hangup /><Leave />'
30
+ '<Sms from="+10987654321" to="+11234567890">twilio sms</Sms></Response>'
30
31
)
31
32
32
33
def test_response_chain (self ):
@@ -41,7 +42,8 @@ def test_response_chain(self):
41
42
42
43
assert_equal (
43
44
self .strip (r ),
44
- '<?xml version="1.0" encoding="UTF-8"?><Response><Hangup /><Leave /><Sms from="+10987654321" to="+11234567890">twilio sms</Sms></Response>'
45
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Hangup /><Leave />'
46
+ '<Sms from="+10987654321" to="+11234567890">twilio sms</Sms></Response>'
45
47
)
46
48
47
49
def test_nested_verbs (self ):
@@ -124,7 +126,8 @@ def test_say_all(self):
124
126
125
127
assert_equal (
126
128
self .strip (r ),
127
- '<?xml version="1.0" encoding="UTF-8"?><Response><Say language="fr" loop="3" voice="man">Hello Monkey</Say></Response>'
129
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Say language="fr" loop="3" voice="man">'
130
+ 'Hello Monkey</Say></Response>'
128
131
)
129
132
130
133
@@ -200,7 +203,8 @@ def test_record_max_length_finish_timeout(self):
200
203
201
204
assert_equal (
202
205
self .strip (r ),
203
- '<?xml version="1.0" encoding="UTF-8"?><Response><Record finishOnKey="#" maxLength="30" timeout="4" /></Response>'
206
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Record finishOnKey="#" maxLength="30" timeout="4" '
207
+ '/></Response>'
204
208
)
205
209
206
210
def test_record_transcribe (self ):
@@ -240,7 +244,8 @@ def test_redirect_method_params(self):
240
244
241
245
assert_equal (
242
246
self .strip (r ),
243
- '<?xml version="1.0" encoding="UTF-8"?><Response><Redirect method="POST">example.com?id=34&action=hey</Redirect></Response>'
247
+ '<?xml version="1.0" encoding="UTF-8"?><Response>'
248
+ '<Redirect method="POST">example.com?id=34&action=hey</Redirect></Response>'
244
249
)
245
250
246
251
@@ -312,7 +317,9 @@ def test_to_from_action(self):
312
317
313
318
assert_equal (
314
319
self .strip (r ),
315
- '<?xml version="1.0" encoding="UTF-8"?><Response><Sms from="3453453456" statusCallback="example.com?id=34&action=hey" to="1231231234">Hello, World</Sms></Response>'
320
+ '<?xml version="1.0" encoding="UTF-8"?><Response>'
321
+ '<Sms from="3453453456" statusCallback="example.com?id=34&action=hey" to="1231231234">'
322
+ 'Hello, World</Sms></Response>'
316
323
)
317
324
318
325
def test_action_method (self ):
@@ -322,7 +329,8 @@ def test_action_method(self):
322
329
323
330
assert_equal (
324
331
self .strip (r ),
325
- '<?xml version="1.0" encoding="UTF-8"?><Response><Sms action="example.com?id=34&action=hey" method="POST">Hello</Sms></Response>'
332
+ '<?xml version="1.0" encoding="UTF-8"?><Response>'
333
+ '<Sms action="example.com?id=34&action=hey" method="POST">Hello</Sms></Response>'
326
334
)
327
335
328
336
@@ -343,7 +351,9 @@ def test_conference(self):
343
351
344
352
assert_equal (
345
353
self .strip (r ),
346
- '<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Conference beep="false" endConferenceOnExit="true" startConferenceOnEnter="true" waitUrl="">TestConferenceAttributes</Conference></Dial></Response>'
354
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Dial>'
355
+ '<Conference beep="false" endConferenceOnExit="true" startConferenceOnEnter="true" waitUrl="">'
356
+ 'TestConferenceAttributes</Conference></Dial></Response>'
347
357
)
1E0A
348
358
349
359
def test_muted_conference (self ):
@@ -362,7 +372,9 @@ def test_muted_conference(self):
362
372
363
373
assert_equal (
364
374
self .strip (r ),
365
- '<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Conference beep="false" endConferenceOnExit="true" muted="true" startConferenceOnEnter="true" waitUrl="">TestConferenceMutedAttribute</Conference></Dial></Response>'
375
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Dial>'
376
+ '<Conference beep="false" endConferenceOnExit="true" muted="true" startConferenceOnEnter="true" waitUrl="">'
377
+ 'TestConferenceMutedAttribute</Conference></Dial></Response>'
366
378
)
367
379
368
380
@@ -377,7 +389,8 @@ def test_queue(self):
377
389
378
390
assert_equal (
379
391
self .strip (r ),
380
- '<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Queue method="GET" url="">TestQueueAttribute</Queue></Dial></Response>'
392
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Dial>'
393
+ '<Queue method="GET" url="">TestQueueAttribute</Queue></Dial></Response>'
381
394
)
382
395
383
396
@@ -407,7 +420,9 @@ def test_enqueue(self):
407
420
408
421
assert_equal (
409
422
self .strip (r ),
410
- '<?xml version="1.0" encoding="UTF-8"?><Response><Enqueue action="act" method="GET" waitUrl="wait" waitUrlMethod="POST">TestEnqueueAttribute</Enqueue></Response>'
423
+ '<?xml version="1.0" encoding="UTF-8"?><Response>'
424
+ '<Enqueue action="act" method="GET" waitUrl="wait" waitUrlMethod="POST">TestEnqueueAttribute</Enqueue>'
425
+ '</Response>'
411
426
)
412
427
413
428
def test_task_string (self ):
@@ -419,7 +434,8 @@ def test_task_string(self):
419
434
420
435
assert_equal (
421
436
self .strip (r ),
422
- '<?xml version="1.0" encoding="UTF-8"?><Response><Enqueue workflowSid="123123123"><Task>{"account_sid": "AC123123123"}</Task></Enqueue></Response>'
437
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Enqueue workflowSid="123123123">'
438
+ '<Task>{"account_sid": "AC123123123"}</Task></Enqueue></Response>'
423
439
)
424
440
425
441
def test_task_dict (self ):
@@ -430,7 +446,8 @@ def test_task_dict(self):
430
446
r .append (e )
431
447
432
448
assert_equal (
433
- '<?xml version="1.0" encoding="UTF-8"?><Response><Enqueue workflowSid="123123123"><Task>{"account_sid": "AC123123123"}</Task></Enqueue></Response>' ,
449
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Enqueue workflowSid="123123123">'
450
+ '<Task>{"account_sid": "AC123123123"}</Task></Enqueue></Response>' ,
434
451
self .strip (r )
435
452
)
436
453
@@ -482,7 +499,8 @@ def test_sip_username_password(self):
482
499
483
500
assert_equal (
484
501
self .strip (r ),
485
- '<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Sip password="bar" username="foo">foo@example.com</Sip></Dial></Response>'
502
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Dial>'
503
+ '<Sip password="bar" username="foo">foo@example.com</Sip></Dial></Response>'
486
504
)
487
505
488
506
def test_add_number (self ):
@@ -508,7 +526,9 @@ def test_add_number_status_callback_event(self):
508
526
509
527
assert_equal (
510
528
self .strip (r ),
511
- '<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Number statusCallback="http://example.com" statusCallbackEvent="initiated completed">1231231234</Number></Dial></Response>'
529
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Dial>'
530
+ '<Number statusCallback="http://example.com" statusCallbackEvent="initiated completed">1231231234</Number>'
531
+ '</Dial></Response>'
512
532
)
513
533
514
534
def test_add_conference (self ):
@@ -600,7 +620,8 @@ def test_nested_say_play_pause(self):
600
620
601
621
assert_equal (
602
622
self .strip (r ),
603
- '<?xml version="1.0" encoding="UTF-8"?><Response><Gather><Say>Hey</Say><Play>hey.mp3</Play><Pause /></Gather></Response>'
623
+ '<?xml version="1.0" encoding="UTF-8"?><Response><Gather><Say>Hey</Say><Play>hey.mp3</Play>'
624
+ '<Pause /></Gather></Response>'
604
625
)
605
626
606
627
@@ -624,3 +645,14 @@ def text_mixed(self):
624
645
self .strip (r ),
625
646
'<?xml version="1.0" encoding="UTF-8"?><Response>before<Say>Content</Say>after</Response>'
626
647
)
648
+
649
+ def test_add_child (self ):
650
+ with VoiceResponse () as r :
651
+ with r .add_child ('alexa' , omnipresent = 'true' ) as alexa :
652
+ alexa .add_child ('purchase' , 'Kindle' )
653
+
654
+ assert_equal (
655
+ self .strip (r ),
656
+ '<?xml version="1.0" encoding="UTF-8"?><Response><alexa omnipresent="true">'
657
+ '<purchase>Kindle</purchase></alexa></Response>'
658
+ )
0 commit comments