some
[appoyo.git] / vendor / plugins / facebooker / test / facebooker / mobile_test.rb
blob509d1d63afb06140daf92f802aacf5ab526856dc
1 require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
3 class Facebooker::MobileTest < Test::Unit::TestCase
4   def setup
5     @session = Facebooker::Session.create('apikey', 'secretkey')
6     @user = Facebooker::User.new(1234, @session)
7     Facebooker.use_curl=false
8   end
9   
10   def test_can_send
11     expect_http_posts_with_responses(example_can_send_xml)
12     assert(@session.mobile.can_send(@user))
13   end
15   def test_send
16     expect_http_posts_with_responses(example_send_xml)
17     assert(@session.mobile.send(@user, "Some sort of message"))    
18   end
20 private
21   def example_can_send_xml
22     <<-XML
23     <?xml version="1.0" encoding="UTF-8"?>
24     <sms_canSend_response
25       xmlns="http://api.facebook.com/1.0/"
26       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
27       xsi:schemaLocation="http://api.facebook.com/1.0/http://api.facebook.com/1.0/facebook.xsd">
28       0
29     </sms_canSend_response>
30     XML
31   end
32   
33   def example_send_xml
34     <<-XML
35     <?xml version="1.0" encoding="UTF-8"?>
36     <sms_send_response
37       xmlns="http://api.facebook.com/1.0/"
38       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
39       xsi:schemaLocation="http://api.facebook.com/1.0/http://api.facebook.com/1.0/facebook.xsd">
40       0
41     </sms_send_response>
42     XML
43   end
44   
45 end