tests: fix nicoseiga download tests.
This commit is contained in:
@@ -1,32 +0,0 @@
|
|||||||
require "test_helper"
|
|
||||||
|
|
||||||
module Downloads
|
|
||||||
class NicoSeigaTest < ActiveSupport::TestCase
|
|
||||||
context "downloading a 'http://seiga.nicovideo.jp/seiga/:id' url" do
|
|
||||||
should "download the original file" do
|
|
||||||
@source = "http://seiga.nicovideo.jp/seiga/im4937663"
|
|
||||||
@rewrite = %r!http://lohas.nicoseiga.jp/priv/\h{40}/\d+/4937663!
|
|
||||||
assert_rewritten(@rewrite, @source)
|
|
||||||
assert_downloaded(2032, @source)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "downloading a 'http://lohas.nicoseiga.jp/o/:hash/:id' url" do
|
|
||||||
should "download the original file" do
|
|
||||||
@source = "http://lohas.nicoseiga.jp/o/910aecf08e542285862954017f8a33a8c32a8aec/1433298801/4937663"
|
|
||||||
@rewrite = %r!http://lohas.nicoseiga.jp/priv/\h{40}/\d+/4937663!
|
|
||||||
assert_rewritten(@rewrite, @source)
|
|
||||||
assert_downloaded(2032, @source)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "downloading a 'https://lohas.nicoseiga.jp/thumb/:id' url" do
|
|
||||||
should "download the original file" do
|
|
||||||
@source = "https://lohas.nicoseiga.jp/thumb/4937663i"
|
|
||||||
@rewrite = %r!http://lohas.nicoseiga.jp/priv/\h{40}/\d+/4937663!
|
|
||||||
assert_rewritten(@rewrite, @source)
|
|
||||||
assert_downloaded(2032, @source)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -147,5 +147,32 @@ module Sources
|
|||||||
assert_equal(bad_source, Sources::Strategies.normalize_source(bad_source))
|
assert_equal(bad_source, Sources::Strategies.normalize_source(bad_source))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "downloading a 'http://seiga.nicovideo.jp/seiga/:id' url" do
|
||||||
|
should "download the original file" do
|
||||||
|
@source = "http://seiga.nicovideo.jp/seiga/im4937663"
|
||||||
|
@rewrite = %r{https://lohas.nicoseiga.jp/priv/\h{40}/\d+/4937663}
|
||||||
|
assert_rewritten(@rewrite, @source)
|
||||||
|
assert_downloaded(2_032, @source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "downloading a 'http://lohas.nicoseiga.jp/o/:hash/:id' url" do
|
||||||
|
should "download the original file" do
|
||||||
|
@source = "http://lohas.nicoseiga.jp/o/910aecf08e542285862954017f8a33a8c32a8aec/1433298801/4937663"
|
||||||
|
@rewrite = %r{https://lohas.nicoseiga.jp/priv/\h{40}/\d+/4937663}
|
||||||
|
assert_rewritten(@rewrite, @source)
|
||||||
|
assert_downloaded(2_032, @source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "downloading a 'https://lohas.nicoseiga.jp/thumb/:id' url" do
|
||||||
|
should "download the original file" do
|
||||||
|
@source = "https://lohas.nicoseiga.jp/thumb/4937663i"
|
||||||
|
@rewrite = %r{https://lohas.nicoseiga.jp/priv/\h{40}/\d+/4937663}
|
||||||
|
assert_rewritten(@rewrite, @source)
|
||||||
|
assert_downloaded(2_032, @source)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user