From b583b3c8109d888a05f647f463b67b09a3205694 Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 16 Jun 2020 00:04:31 -0500 Subject: [PATCH] tests: fix nicoseiga download tests. --- test/unit/downloads/nico_seiga_test.rb | 32 -------------------------- test/unit/sources/nico_seiga_test.rb | 27 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 32 deletions(-) delete mode 100644 test/unit/downloads/nico_seiga_test.rb diff --git a/test/unit/downloads/nico_seiga_test.rb b/test/unit/downloads/nico_seiga_test.rb deleted file mode 100644 index de00ed7bb..000000000 --- a/test/unit/downloads/nico_seiga_test.rb +++ /dev/null @@ -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 diff --git a/test/unit/sources/nico_seiga_test.rb b/test/unit/sources/nico_seiga_test.rb index 9ab04edb4..ff2645d9a 100644 --- a/test/unit/sources/nico_seiga_test.rb +++ b/test/unit/sources/nico_seiga_test.rb @@ -147,5 +147,32 @@ module Sources assert_equal(bad_source, Sources::Strategies.normalize_source(bad_source)) 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