# blogサービスの種類
-# 'livedoor' or 'blogger'
+# 'livedoor' or 'blogger' or 'hatena'
# default は 'livedoor'
-@service = 'service'
+@service = 'livedoor'
# 認証タイプ
# 'wsse' or 'google'
# default は 'wsse'
-@auth_type = 'auth'
+@auth_type = 'wsse'
# atomapiのURI
-@atom_api_uri = "http://cms.blog.livedoor.com/atom"
-
-# ブログID
-@blog_id = 'testid'
-
-# 記事をPOSTするときのURI
-# @atom_api_uriと@blog_idを指定していれば不要。
-@post_uri = "http://cms.blog.livedoor.com/atom/blog_id=#{@blog_id}"
-
-# ファイルをアップロードするときのURI
-# @atom_api_uriと@blog_idを指定していれば不要。
-@upload_uri = "http://cms.blog.livedoor.com/atom/blog_id=#{@blog_id}/svc=upload"
+@atompub_uri = "http://cms.blog.livedoor.com/atom"
# ユーザ名
@username = "test_user"
return ""
end
-
-if $0 == __FILE__
- $test = true
-end
-
-if defined?($test) && $test
- require 'test/unit'
- require 'ldblogwriter/config'
-
- class TestAddBookScope < Test::Unit::TestCase
- def setup
- @conf = LDBlogWriter::Config.new()
- end
-
- def test_no_userid
- assert_equal("<!-- ユーザIDが設定されていません -->\n", add_bookscope('1'))
- end
-
- def test_add_bookscope
- @conf.options['bookscope_name'] = 'testid'
- assert_equal("<!-- BookScopeに登録しました -->\n", add_bookscope('1'))
- end
- end
-end
""
end
-if $0 == __FILE__
- $test = true
-end
-
-if defined?($test) && $test
- require 'test/unit'
- require 'ldblogwriter/config'
-
-end
uri = URI.encode("http://www.google.co.jp/search?hl=ja&q=#{str}&lr=lang_ja")
%Q!<a href="#{uri}">#{str}</a>!
end
-
-if $0 == __FILE__
- $test = true
-end
-
-if defined?($test) && $test
- require 'test/unit'
-
- class TestGoogle < Test::Unit::TestCase
- def setup
- end
-
- def test_google
- assert_equal(%Q!<a href="http://www.google.co.jp/search?hl=ja&q=%E3%81%BB%E3%81%92&lr=lang_ja">ほげ</a>!, google("ほげ"))
- end
- end
-end
+# -*- coding: utf-8 -*-
# 基本構文は、http: //maps.google.com/staticmap?parameters です。この parameters の部分に位置情報やマップのサイズ、マーカー情報などを指定します。使用できるパラメータには次のものがあります。
# ・center( 必須 ): マップの中央の座標を緯度と経度で指定します。 ( 例 :center=35.65641,139.699477)
return str
end
-if $0 == __FILE__
- $test = true
-end
-
-if defined?($test) && $test
- require 'test/unit'
- require 'ldblogwriter/config'
-
- class TestGoogleStaticMap < Test::Unit::TestCase
- def setup
- @conf = LDBlogWriter::Config.new(ENV['HOME']+"/.ldblogwriter.conf")
- end
-
- def test_google_staticmap
- assert_equal(%Q!<script type="text/javascript" src="http://www.nicovideo.jp/thumb_watch/sm281634?w=485&h=385"></script>\n!, google_staticmap(35.688394,139.77132))
- end
- end
-end
-
return str
end
-if $0 == __FILE__
- $test = true
-end
-
-if defined?($test) && $test
- require 'test/unit'
-
- class TestGoogle < Test::Unit::TestCase
- def setup
- end
-
- def test_google
- assert_equal(%Q!<script type="text/javascript" src="http://www.nicovideo.jp/thumb_watch/sm281634?w=485&h=385" charset="utf-8"></script>\n!, niconico("sm281634"))
- end
- end
-end
-
return ""
end
-
-if $0 == __FILE__
- $test = true
-end
-
-if defined?($test) && $test
- require 'test/unit'
- require 'ldblogwriter/config'
-
- class TestPICS < Test::Unit::TestCase
- def setup
- @conf = LDBlogWriter::Config.new()
- end
-
- # livedoor Blogの場合のみ有効
- # @conf['service']がlivedoorのときのみ
- # それ以外の場合には、何もせず空白文字列を返す
- def test_service
- @conf.service = 'blogger'
- assert_equal("", pics('dummy_path'))
- end
-
- # 引数で指定したファイルが見つからなければ、
- # エラーメッセージをHTMLのコメント形式で返す。
- def test_no_such_file
- assert_equal("<!-- dummy_path が見つかりません -->\n", pics('dummy_path'))
- end
-
- # 投稿に失敗した場合、
- # エラーメッセージをHTMlのコメント形式で返す。
- def test_post_failure
- assert_equal(false, pics('pics.rb'))
- end
-
- # 投稿に成功したら、
- # responseから画像のURLが分かる筈
- def test_post
- @conf = LDBlogWriter::Config.new(ENV['HOME'] + '/.ldblogwriter.conf')
- puts pics('test1.jpg')
- end
-
- # 同じタイトルで投稿したら?
-
- # photo_id指定
- def test_photo_id
- @conf = LDBlogWriter::Config.new(ENV['HOME'] + '/.ldblogwriter.conf')
- end
- end
-
- class TestLivedoorPICS < Test::Unit::TestCase
- def test_post
- Livedoor::PICS.post
- end
- end
-end
-
stack.edit_note(asin, @entry.alternate)
end
-if $0 == __FILE__
- $test = true
-end
-
-if defined?($test) && $test
- require 'test/unit'
- require 'ldblogwriter/config'
-
-
- class TestStack < Test::Unit::TestCase
- def setup
- @conf = LDBlogWriter::Config.new()
- end
-
- # 利用者IDとAPIトークンが設定されてなければ、エラー
- def test_config
- end
-
- # asinとstateのチェック
- def test_args
- end
-
- end
-end
-
+++ /dev/null
-require 'test/unit'
-require '../lib/ldblogwriter/config'
-require 'asin.rb'
-
-class TestAmazonECS < Test::Unit::TestCase
- def setup
- @config = LDBlogWriter::Config.new(ENV['HOME']+'/.ldblogwriter.conf')
- @ecs = AmazonECS.new('subscription_id' => @config.options['amazon_sub_id'],
- 'associate_tag' => @config.options['amazon_assoc_id'])
- end
-
- def test_item_lookup
- assert(@ecs.item_lookup('4101181764'))
- assert(@ecs.item_lookup('406276007X'))
- end
-end
--- /dev/null
+# -*- coding: utf-8 -*-
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'plugins'
+
+require 'mechanize'
+require 'mocha'
+require 'test/unit'
+require 'ldblogwriter/config.rb'
+require 'add_bookscope.rb'
+
+class TestPluginAddBookScope < Test::Unit::TestCase
+ def setup
+ @conf = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+ def test_no_userid
+ @conf.options['bookscope_name'] = nil
+ assert_equal("<!-- ユーザIDが設定されていません -->\n", add_bookscope('1'))
+ end
+
+ def test_add_bookscope
+ WWW::Mechanize.any_instance.stubs(:post).returns("hoge")
+
+ @conf.options['bookscope_name'] = 'testid'
+ assert_equal("", add_bookscope('1'))
+ end
+
+end
$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'plugins'
require 'test/unit'
#require 'ldblogwriter/plugin.rb'
--- /dev/null
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'plugins'
+
+require 'mechanize'
+require 'mocha'
+
+require 'test/unit'
+
+require 'ldblogwriter/config.rb'
+require 'booklog.rb'
+
+class TestPluginBookLog < Test::Unit::TestCase
+ def setup
+ @config = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+end
--- /dev/null
+# -*- coding: utf-8 -*-
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'plugins'
+
+require 'test/unit'
+require 'ldblogwriter/config.rb'
+require 'google.rb'
+
+class TestPluginGoogle < Test::Unit::TestCase
+ def setup
+ end
+
+ def test_google
+ assert_equal(%Q!<a href="http://www.google.co.jp/search?hl=ja&q=%E3%81%BB%E3%81%92&lr=lang_ja">ほげ</a>!, google("ほげ"))
+ end
+end
--- /dev/null
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'plugins'
+
+require 'test/unit'
+require 'ldblogwriter/config.rb'
+require 'google_staticmap.rb'
+
+class TestPluginGoogleStaticMap < Test::Unit::TestCase
+ def setup
+ @conf = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+end
--- /dev/null
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'plugins'
+
+require 'test/unit'
+require 'ldblogwriter/config.rb'
+require 'hatenagraph.rb'
+
+class TestPluginHatenaGraph < Test::Unit::TestCase
+ def setup
+ @config = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+
+end
--- /dev/null
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'plugins'
+
+require 'test/unit'
+require 'ldblogwriter/config.rb'
+require 'niconico.rb'
+
+class TestPluginNicoNico < Test::Unit::TestCase
+ def setup
+ @config = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+
+ def test_niconico
+ assert_equal(%Q!<script type="text/javascript" src="http://www.nicovideo.jp/thumb_watch/sm281634?w=485&h=385" charset="utf-8"></script>\n!, niconico("sm281634"))
+ end
+
+
+end
--- /dev/null
+# -*- coding: utf-8 -*-
+
+$LOAD_PATH.unshift 'lib'
+$LOAD_PATH.unshift 'plugins'
+
+require 'test/unit'
+require 'ldblogwriter/config.rb'
+require 'pics.rb'
+
+class TestPluginPics < Test::Unit::TestCase
+ def setup
+ @config = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+ # livedoor Blogの場合のみ有効
+ # @conf['service']がlivedoorのときのみ
+ # それ以外の場合には、何もせず空白文字列を返す
+ def test_service
+ @conf.service = 'blogger'
+ assert_equal("", pics('dummy_path'))
+ end
+
+ # 引数で指定したファイルが見つからなければ、
+ # エラーメッセージをHTMLのコメント形式で返す。
+ def test_no_such_file
+ assert_equal("<!-- dummy_path が見つかりません -->\n", pics('dummy_path'))
+ end
+
+ # 投稿に失敗した場合、
+ # エラーメッセージをHTMlのコメント形式で返す。
+ def test_post_failure
+ assert_equal(false, pics('pics.rb'))
+ end
+
+ # 投稿に成功したら、
+ # responseから画像のURLが分かる筈
+ def test_post
+ @conf = LDBlogWriter::Config.new(ENV['HOME'] + '/.ldblogwriter.conf')
+ puts pics('test1.jpg')
+ end
+
+
+end
--- /dev/null
+$LOAD_PATH.unshift 'lib'
+
+require 'test/unit'
+#require 'ldblogwriter/plugin.rb'
+require 'ldblogwriter/config.rb'
+require 'ldblogwriter/plugin/asin.rb'
+
+class TestPluginStack < Test::Unit::TestCase
+ def setup
+ @config = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+
+end
--- /dev/null
+$LOAD_PATH.unshift 'lib'
+
+require 'test/unit'
+#require 'ldblogwriter/plugin.rb'
+require 'ldblogwriter/config.rb'
+require 'ldblogwriter/plugin/asin.rb'
+
+class TestPluginTag < Test::Unit::TestCase
+ def setup
+ @config = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+
+end
--- /dev/null
+$LOAD_PATH.unshift 'lib'
+
+require 'test/unit'
+#require 'ldblogwriter/plugin.rb'
+require 'ldblogwriter/config.rb'
+require 'ldblogwriter/plugin/asin.rb'
+
+class TestPluginYoutube < Test::Unit::TestCase
+ def setup
+ @config = LDBlogWriter::Config.new(ENV['HOME'] + "/.ldblogwriter.conf")
+ end
+
+
+end
$LOAD_PATH.unshift 'lib'
+require 'mocha'
+
require 'test/unit'
require 'ldblogwriter.rb'
require 'ldblogwriter/plugin.rb'
require 'ldblogwriter/entry.rb'
+require 'test/plugin/test-plugin_add_bookscope.rb'
require 'test/plugin/test-plugin_asin.rb'
+require 'test/plugin/test-plugin_booklog.rb'
+require 'test/plugin/test-plugin_google.rb'
+require 'test/plugin/test-plugin_google_staticmap.rb'
+require 'test/plugin/test-plugin_hatenagraph.rb'
+require 'test/plugin/test-plugin_niconico.rb'
+require 'test/plugin/test-plugin_pics.rb'
+require 'test/plugin/test-plugin_stack.rb'
+require 'test/plugin/test-plugin_tag.rb'
+require 'test/plugin/test-plugin_youtube.rb'
class TestPlugin < Test::Unit::TestCase
def setup