PageRenderTime 55ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/test/twilio/test/twiml/voice.clj

https://github.com/sethtrain/clj-twilio
Clojure | 48 lines | 42 code | 6 blank | 0 comment | 15 complexity | 7a206e22e718cfbe09a2bb2e42f2350a MD5 | raw file
  1. (ns twilio.test.twiml.voice
  2. (:use [twilio.twiml.voice] :reload)
  3. (:use [clojure.test]
  4. [twilio.twiml.core]))
  5. (deftest test-say
  6. (is (= (say "Hello World")
  7. [:Say {} "Hello World"]))
  8. (is (= (say {:voice "woman"} "Hello World")
  9. [:Say {:voice "woman"} "Hello World"])))
  10. (deftest test-play
  11. (is (= (play "http://foo.bar.com/hello.mp3")
  12. [:Play {} "http://foo.bar.com/hello.mp3"]))
  13. (is (= (play {:loop 1} "http://foo.bar.com/hello.mp3")
  14. [:Play {:loop 1} "http://foo.bar.com/hello.mp3"])))
  15. (deftest test-gather
  16. (is (= (gather)
  17. [:Gather {} nil]))
  18. (is (= (gather (say "Please enter your account number."))
  19. [:Gather {} (list [:Say {} "Please enter your account number."])]))
  20. (is (= (gather {} (say "Please enter your account number.")
  21. (play "http://foo.bar.com/account_music.mp3"))
  22. [:Gather {} (list [:Say {} "Please enter your account number."]
  23. [:Play {} "http://foo.bar.com/account_music.mp3"])])))
  24. (deftest test-record
  25. (is (= (record)
  26. [:Record {}]))
  27. (is (= (record {:maxLength 20 :method "GET"})
  28. [:Record {:maxLength 20 :method "GET"}])))
  29. (deftest test-dial-number
  30. (is (= (dial (number "123-555-5555"))
  31. [:Dial {} (list [:Number {} "123-555-5555"])]))
  32. (is (= (dial (number {:sendDigits "9999"} "123-555-5555"))
  33. [:Dial {} (list [:Number {:sendDigits "9999"} "123-555-5555"])]))
  34. (is (= (dial {:method "POST"} (number "123-555-5555"))
  35. [:Dial {:method "POST"} (list [:Number {} "123-555-5555"])])))
  36. (deftest test-dial-conference
  37. (is (= (dial (conference "123-555-5555"))
  38. [:Dial {} (list [:Conference {} "123-555-5555"])]))
  39. (is (= (dial (conference {:startConferenceOnEnter "true"} "123-555-5555"))
  40. [:Dial {} (list [:Conference {:startConferenceOnEnter "true"} "123-555-5555"])]))
  41. (is (= (dial {:method "POST"} (conference "123-555-5555"))
  42. [:Dial {:method "POST"} (list [:Conference {} "123-555-5555"])])))