test/tumblr4r_test.rb in tumblr4r-0.7.2 vs test/tumblr4r_test.rb in tumblr4r-0.8.0
- old
+ new
@@ -1,5 +1,6 @@
+# -*- coding: utf-8 -*-
require File.dirname(__FILE__) + '/test_helper.rb'
require "test/unit"
require 'pit'
class Tumblr4rTest < Test::Unit::TestCase
include Tumblr4r
@@ -51,10 +52,11 @@
total = @large_site.count(:search => "test")
assert_equal TOTAL_COUNT, total
end
def test_find
+ debugger
posts = @site.find(:all)
assert_equal 9, posts.size
assert_equal Photo, posts[0].class
end
@@ -142,11 +144,11 @@
assert_equal "html", posts[1].format
assert_equal [], posts[1].tags
assert_equal false, posts[1].bookmarklet
assert_equal "", posts[1].regular_title
- assert_equal "Tumblr4rのテストです", posts[1].regular_body
+ assert_equal "<p>Tumblr4rのテストです</p>", posts[1].regular_body
end
def test_find_with_type_photo
posts = @site.find(:all, :type => "photo")
assert_equal 2, posts.size
@@ -164,11 +166,11 @@
assert_equal ["test", "photo"], posts[1].tags
assert_equal false, posts[1].bookmarklet
assert_equal "<p>Photoのテストです。</p>\n\n<p>ギコです。</p>", posts[1].photo_caption
assert_equal "http://www.google.co.jp/", posts[1].photo_link_url
- assert_equal "http://5.media.tumblr.com/GyEYZujUYopiula4XKmXhCgmo1_250.jpg", posts[1].photo_url
+ assert_equal "http://28.media.tumblr.com/GyEYZujUYopiula4XKmXhCgmo1_250.jpg", posts[1].photo_url
assert_equal [], posts[1].photoset
# photoset
assert_equal Photo, posts[0].class
assert_equal 211868268, posts[0].post_id
@@ -180,16 +182,16 @@
assert_equal 1255429144, posts[0].unix_timestamp
assert_equal "html", posts[0].format
assert_equal [], posts[0].tags
assert_equal false, posts[0].bookmarklet
- assert_equal "Photoset test.", posts[0].photo_caption
+ assert_equal "<p>Photoset test.</p>", posts[0].photo_caption
assert_equal "", posts[0].photo_link_url
- assert_equal "http://22.media.tumblr.com/tumblr_krg7btBOD21qzfaavo1_250.jpg", posts[0].photo_url
- assert_equal ["http://22.media.tumblr.com/tumblr_krg7btBOD21qzfaavo1_250.jpg",
- "http://6.media.tumblr.com/tumblr_krg7btBOD21qzfaavo2_500.jpg",
- "http://16.media.tumblr.com/tumblr_krg7btBOD21qzfaavo3_500.png"], posts[0].photoset
+ assert_equal "http://25.media.tumblr.com/tumblr_krg7btBOD21qzfaavo1_250.jpg", posts[0].photo_url
+ assert_equal ["http://25.media.tumblr.com/tumblr_krg7btBOD21qzfaavo1_250.jpg",
+ "http://30.media.tumblr.com/tumblr_krg7btBOD21qzfaavo2_500.jpg",
+ "http://27.media.tumblr.com/tumblr_krg7btBOD21qzfaavo3_500.png"], posts[0].photoset
end
def test_find_with_type_quote
posts = @site.find(:all, :type => "quote")
@@ -227,11 +229,11 @@
assert_equal ["test", "link"], posts[0].tags
assert_equal false, posts[0].bookmarklet
assert_equal "たんぶらー", posts[0].link_text
assert_equal "http://www.tumblr.com/", posts[0].link_url
- assert_equal "ですくりぷしょん", posts[0].link_description
+ assert_equal "<p>ですくりぷしょん</p>", posts[0].link_description
end
def test_find_with_type_conversation
posts = @site.find(:all, :type => "conversation")
assert_equal 1, posts.size
@@ -272,12 +274,13 @@
assert_equal "html", posts[0].format
assert_equal [], posts[0].tags
assert_equal false, posts[0].bookmarklet
assert_equal true, posts[0].audio_plays
- assert_equal "tumblr4r miku", posts[0].audio_caption
- assert_equal "<embed type=\"application/x-shockwave-flash\" src=\"http://tumblr4rtest.tumblr.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/131705561/GyEYZujUYp9df3nv1WMefTH8&color=FFFFFF\" height=\"27\" width=\"207\" quality=\"best\"></embed>", posts[0].audio_player
+ assert_equal "<p>tumblr4r miku</p>", posts[0].audio_caption
+# assert_equal "<embed type=\"application/x-shockwave-flash\" src=\"http://tumblr4rtest.tumblr.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/131705561/GyEYZujUYp9df3nv1WMefTH8&color=FFFFFF\" height=\"27\" width=\"207\" quality=\"best\"></embed>", posts[0].audio_player
+ assert_equal "<embed type=\"application/x-shockwave-flash\" src=\"http://assets.tumblr.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/131705561/GyEYZujUYp9df3nv1WMefTH8&color=FFFFFF\" height=\"27\" width=\"207\" quality=\"best\"></embed>", posts[0].audio_player
end
def test_find_with_type_video
posts = @site.find(:all, :type => "video")
assert_equal 1, posts.size
@@ -291,13 +294,13 @@
assert_equal 1246198976, posts[0].unix_timestamp
assert_equal "html", posts[0].format
assert_equal [], posts[0].tags
assert_equal false, posts[0].bookmarklet
- assert_equal "matrix sappoloaded", posts[0].video_caption
+ assert_equal "<p>matrix sappoloaded</p>", posts[0].video_caption
assert_equal "http://www.youtube.com/watch?v=FavWH5RhYpw", posts[0].video_source
- assert_equal "<object width=\"400\" height=\"336\"><param name=\"movie\" value=\"http://www.youtube.com/v/FavWH5RhYpw&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/FavWH5RhYpw&rel=0&egm=0&showinfo=0&fs=1\" type=\"application/x-shockwave-flash\" width=\"400\" height=\"336\" allowFullScreen=\"true\" wmode=\"transparent\"></embed></object>", posts[0].video_player
+ assert_equal "<object width=\"400\" height=\"325\"><param name=\"movie\" value=\"http://www.youtube.com/v/FavWH5RhYpw&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/FavWH5RhYpw&rel=0&egm=0&showinfo=0&fs=1\" type=\"application/x-shockwave-flash\" width=\"400\" height=\"325\" allowFullScreen=\"true\" wmode=\"transparent\"></embed></object>", posts[0].video_player
end
def test_find_with_tagged
posts = @site.find(:all, :tagged => "test")
assert_equal 5, posts.size
@@ -400,8 +403,7 @@
def test_video_create
videos = @site.find(:all, :type => Tumblr4r::POST_TYPE::VIDEO)
post = @write_site.save(videos[0])
end
-
end