$: << File.join(File.dirname(__FILE__), "/../lib" )
require 'spec'
require 'rumblr'
def mock_successful(request)
responses_to = {
:authenticate => successful_authenticate_xml,
:anonymous_read => successful_anonymous_read_xml,
:authenticated_read => successful_authenticated_read_xml,
:authenticated_write => successful_authenticated_write_xml
}
@client = Rumblr::Client.instance
if request == :authenticated_write
@client.stub!(:complete_request).and_return(responses_to[request])
else
# yes, this is cheating, but for now just concerned that xml is parsed right
@client.stub!(:complete_request).and_yield(responses_to[request])
end
end
def successful_authenticate_xml
response = <<-EOF
EOF
response.strip!
end
def successful_anonymous_read_xml
response = <<-EOF
dummylog description
public video post caption
http://www.youtube.com/watch?v=rPaWZOM1LnY
<object width="400" height="336"><param name="movie" value="http://www.youtube.com/v/rPaWZOM1LnY&rel=0&egm=0&showinfo=0&fs=1"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/rPaWZOM1LnY&rel=0&egm=0&showinfo=0&fs=1" type="application/x-shockwave-flash" width="400" height="336" allowFullScreen="true" wmode="transparent"></embed></object>
sale
music
public audio post description<embed type="application/x-shockwave-flash" src="http://dummylog.tumblr.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/78846080/TofwJxqCAk12g1e0ClxHx7gh&color=FFFFFF" height="27" width="207" quality="best"></embed>
sale
public chat post title
me: public
you: chat
me: post
you: dialoguepublic
chat
post
dialoguepublic
chat
post
dialogue
sale
public link post namehttp://www.google.com
public link post description
sale
public quote post content
public quote post source
sale
public text post title
public text post body
sale
public photo post
http://21.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_500.jpg
http://1.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_400.jpg
http://22.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_250.jpg
http://19.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_100.jpg
http://2.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_75sq.jpg
sale
EOF
response.strip!
end
def successful_authenticated_read_xml
response = <<-EOF
dummy tumblelog descriptionprivate video post captionhttp://www.youtube.com/watch?v=rPaWZOM1LnY<object width="400" height="336"><param name="movie" value="http://www.youtube.com/v/rPaWZOM1LnY&rel=0&egm=0&showinfo=0&fs=1"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/rPaWZOM1LnY&rel=0&egm=0&showinfo=0&fs=1" type="application/x-shockwave-flash" width="400" height="336" allowFullScreen="true" wmode="transparent"></embed></object>saletag2musicpublic video post captionhilhttp://www.youtube.com/watch?v=rPaWZOM1LnY<object width="400" height="336"><param name="movie" value="http://www.youtube.com/v/rPaWZOM1LnY&rel=0&egm=0&showinfo=0&fs=1"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/rPaWZOM1LnY&rel=0&egm=0&showinfo=0&fs=1" type="application/x-shockwave-flash" width="400" height="336" allowFullScreen="true" wmode="transparent"></embed></object>hilariousprivate audio post description<embed type="application/x-shockwave-flash" src="http://dummylog.tumblr.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/78846150/TofwJxqCAk12gje4UYRllUwM&color=FFFFFF" height="27" width="207" quality="best"></embed>salepublic audio post description<embed type="application/x-shockwave-flash" src="http://dummylog.tumblr.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/78846080/TofwJxqCAk12g1e0ClxHx7gh&color=FFFFFF" height="27" width="207" quality="best"></embed>salemusicprivate chat post titleme: private
you: chat
me: post
you: dialogueprivate
chat
post
dialogueprivate
chat
post
dialoguesalepublic chat post titleme: public
you: chat
me: post
you: dialoguepublic
chat
post
dialoguepublic
chat
post
dialoguesaleprivate link post namehttp://www.google.comprivate link post descriptionsalepublic link post namehttp://www.google.compublic link post descriptionsalepublic quote post contentpublic quote post sourcesaleprivate quote post contentprivate quote post contentsaleprivate photo posthttp://7.media.tumblr.com/TofwJxqCAk122bofvQLGsl89o1_500.jpghttp://6.media.tumblr.com/TofwJxqCAk122bofvQLGsl89o1_400.jpghttp://11.media.tumblr.com/TofwJxqCAk122bofvQLGsl89o1_250.jpghttp://11.media.tumblr.com/TofwJxqCAk122bofvQLGsl89o1_100.jpghttp://22.media.tumblr.com/TofwJxqCAk122bofvQLGsl89o1_75sq.jpgsaleprivate text post titleprivate text post bodysalepublic text post titlepublic text post bodysalepublic photo posthttp://21.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_500.jpghttp://1.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_400.jpghttp://22.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_250.jpghttp://19.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_100.jpghttp://2.media.tumblr.com/TofwJxqCAk11p5psVgVhLwzJo1_75sq.jpgsale
EOF
response.strip!
end
def successful_authenticated_write_xml
"10001"
end