additional error handling in tests
This commit is contained in:
@@ -484,7 +484,7 @@ class Artist < ApplicationRecord
|
|||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout, PixivApiClient::Error
|
||||||
raise if Rails.env.test?
|
raise if Rails.env.test?
|
||||||
nil
|
nil
|
||||||
rescue Exception
|
rescue Exception
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ArtistUrl < ApplicationRecord
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
url = Sources::Site.new(url).normalize_for_artist_finder!
|
url = Sources::Site.new(url).normalize_for_artist_finder!
|
||||||
rescue PixivApiClient::Error
|
rescue Net::OpenTimeout, PixivApiClient::Error
|
||||||
raise if Rails.env.test?
|
raise if Rails.env.test?
|
||||||
rescue Sources::Site::NoStrategyError
|
rescue Sources::Site::NoStrategyError
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -87,9 +87,13 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
should "process successfully" do
|
should "process successfully" do
|
||||||
_, _, output_file = @upload.download_from_source(@url, "")
|
begin
|
||||||
assert_operator(output_file.size, :>, 1_000)
|
_, _, output_file = @upload.download_from_source(@url, "")
|
||||||
assert_equal("zip", @upload.file_header_to_file_ext(output_file))
|
assert_operator(output_file.size, :>, 1_000)
|
||||||
|
assert_equal("zip", @upload.file_header_to_file_ext(output_file))
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
skip "Remote connection to #{@url} failed"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user