Merge pull request #3116 from evazion/fix-artstation-project-urls

Fix #3108: support https://$artist.artstation.com/projects/$id urls
This commit is contained in:
Albert Yi
2017-06-05 12:45:44 -07:00
committed by GitHub
4 changed files with 65 additions and 5 deletions

View File

@@ -27,5 +27,18 @@ module Downloads
assert_equal("https://cdna.artstation.com/p/assets/images/images/004/730/278/large/mendel-oh-dragonll.jpg", @download.source)
end
end
context "a download for a https://$artist.artstation.com/projects/$id page" do
setup do
@source = "https://dantewontdie.artstation.com/projects/YZK5q"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
@download.download!
end
should "download the original image instead" do
assert_equal("https://cdna.artstation.com/p/assets/images/images/006/066/534/original/yinan-cui-reika.jpg?1495781565", @download.source)
end
end
end
end

View File

@@ -4,7 +4,7 @@ module Sources
class ArtStationTest < ActiveSupport::TestCase
context "The source site for an art station artwork page" do
setup do
@site = Sources::Site.new("https://jeyrain.artstation.com/artwork/04XA4")
@site = Sources::Site.new("https://www.artstation.com/artwork/04XA4")
@site.get
end
@@ -29,5 +29,34 @@ module Sources
assert_equal("", @site.artist_commentary_desc)
end
end
context "The source site for an art station projects page" do
setup do
@site = Sources::Site.new("https://dantewontdie.artstation.com/projects/YZK5q")
@site.get
end
should "get the image url" do
url = "https://cdna.artstation.com/p/assets/images/images/006/066/534/original/yinan-cui-reika.jpg?1495781565"
assert_equal(url, @site.image_url)
end
should "get the profile" do
assert_equal("https://www.artstation.com/artist/dantewontdie", @site.profile_url)
end
should "get the artist name" do
assert_equal("dantewontdie", @site.artist_name)
end
should "get the tags" do
assert_equal(%w[gantz reika], @site.tags.map(&:first))
end
should "get the artist commentary" do
assert_equal("Reika ", @site.artist_commentary_title)
assert_equal("From Gantz.", @site.artist_commentary_desc)
end
end
end
end