tests: fix broken source tests.

Fix various tests broken by source files changing or being deleted.
This commit is contained in:
evazion
2020-11-10 14:38:17 -06:00
parent 3ce8c7f004
commit cc64f8b7ee
6 changed files with 24 additions and 21 deletions

View File

@@ -4,10 +4,11 @@ module Sources
class NewGroundsTest < ActiveSupport::TestCase
context "The source for a newgrounds picture" do
setup do
@url = "https://www.newgrounds.com/art/view/natthelich/fire-emblem-marth-plus-progress-pic"
@comment = "https://art.ngfiles.com/comments/57000/iu_57615_7115981.jpg"
@url = "https://www.newgrounds.com/art/view/natthelich/d-d-light-domain-cleric-nathaniel-8"
@image_url = "https://art.ngfiles.com/images/1138000/1138016_natthelich_d-d-light-domain-cleric-nathaniel-8.png?f1578591058"
@comment = "https://art.ngfiles.com/comments/84000/iu_84427_7115981.jpg"
@image_1 = Sources::Strategies.find(@url)
@image_2 = Sources::Strategies.find("https://art.ngfiles.com/images/1033000/1033622_natthelich_fire-emblem-marth-plus-progress-pic.png?f1569487181")
@image_2 = Sources::Strategies.find(@image_url)
@image_3 = Sources::Strategies.find(@comment, @url)
end
@@ -18,9 +19,9 @@ module Sources
end
should "get the artist commentary title" do
assert_equal("Fire Emblem - Marth (plus progress pic)", @image_1.artist_commentary_title)
assert_equal("Fire Emblem - Marth (plus progress pic)", @image_2.artist_commentary_title)
assert_equal("Fire Emblem - Marth (plus progress pic)", @image_3.artist_commentary_title)
assert_equal("D&D - Light Domain Cleric, Nathaniel", @image_1.artist_commentary_title)
assert_equal("D&D - Light Domain Cleric, Nathaniel", @image_2.artist_commentary_title)
assert_equal("D&D - Light Domain Cleric, Nathaniel", @image_3.artist_commentary_title)
end
should "get profile url" do
@@ -30,10 +31,10 @@ module Sources
end
should "get the image urls" do
assert_match(%r{https?://art\.ngfiles\.com/images/1033000/1033622_natthelich_fire-emblem-marth-plus-progress-pic\.png(?:\?\w+)?}i, @image_1.image_url)
assert_match(%r{https://art.ngfiles.com/images/1138000/1138016_natthelich_d-d-light-domain-cleric-nathaniel-8.png}i, @image_1.image_url)
assert_includes(@image_1.image_urls, @comment)
assert_match(%r{https?://art\.ngfiles\.com/images/1033000/1033622_natthelich_fire-emblem-marth-plus-progress-pic\.png(?:\?\w+)?}i, @image_2.image_url)
assert_match(%r{https://art.ngfiles.com/images/1138000/1138016_natthelich_d-d-light-domain-cleric-nathaniel-8.png}i, @image_2.image_url)
assert_equal(@comment, @image_3.image_url)
end
@@ -44,16 +45,18 @@ module Sources
end
should "download an image" do
assert_downloaded(630365, @image_1.image_url)
assert_downloaded(630365, @image_2.image_url)
assert_downloaded(129033, @image_3.image_url)
assert_downloaded(1195723, @image_1.image_url)
assert_downloaded(1195723, @image_2.image_url)
assert_downloaded(158058, @image_3.image_url)
end
should "get the tags" do
tags = [
%w[fire-emblem https://www.newgrounds.com/search/conduct/art?match=tags&tags=fire-emblem],
%w[marth https://www.newgrounds.com/search/conduct/art?match=tags&tags=marth ]
%w[cleric https://www.newgrounds.com/search/conduct/art?match=tags&tags=cleric],
%w[nathaniel https://www.newgrounds.com/search/conduct/art?match=tags&tags=nathaniel],
%w[oc https://www.newgrounds.com/search/conduct/art?match=tags&tags=oc]
]
assert_equal(tags, @image_1.tags)
assert_equal(tags, @image_2.tags)
assert_equal(tags, @image_3.tags)

View File

@@ -98,7 +98,7 @@ module Sources
end
should "get the remote image size" do
assert_equal(854_653, @site.remote_size)
assert_equal(863_758, @site.remote_size)
end
should "get the full size image url" do