forked from e621ng/e621ng
nijie: add canonical url tests.
This commit is contained in:
parent
736c22c3ce
commit
d6235d6f9e
@ -1081,6 +1081,17 @@ class UploadServiceTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "for nijie" do
|
||||
should "record the canonical source" do
|
||||
page_url = "https://nijie.info/view.php?id=213043"
|
||||
image_url = "https://pic03.nijie.info/nijie_picture/728995_20170505014820_0.jpg"
|
||||
upload = FactoryBot.create(:jpg_upload, file_size: 1000, md5: "12345", file_ext: "jpg", image_width: 100, image_height: 100, source: image_url, referer_url: page_url)
|
||||
|
||||
post = UploadService.new({}).create_post_from_upload(upload)
|
||||
assert_equal(page_url, post.source)
|
||||
end
|
||||
end
|
||||
|
||||
context "for an image" do
|
||||
setup do
|
||||
@upload = FactoryBot.create(:source_upload, file_size: 1000, md5: "12345", file_ext: "jpg", image_width: 100, image_height: 100)
|
||||
|
@ -14,6 +14,10 @@ module Sources
|
||||
assert_equal("https://pic03.nijie.info/nijie_picture/728995_20170505014820_0.jpg", @site.image_url)
|
||||
end
|
||||
|
||||
should "get the canonical url" do
|
||||
assert_equal("https://nijie.info/view.php?id=213043", @site.canonical_url)
|
||||
end
|
||||
|
||||
should "get the profile" do
|
||||
assert_equal("https://nijie.info/members.php?id=728995", @site.profile_url)
|
||||
end
|
||||
@ -54,6 +58,10 @@ module Sources
|
||||
assert_equal("http://pic03.nijie.info/nijie_picture/728995_20170505014820_0.jpg", @site.image_url)
|
||||
end
|
||||
|
||||
should "get the canonical url" do
|
||||
assert_equal("https://nijie.info/view.php?id=213043", @site.canonical_url)
|
||||
end
|
||||
|
||||
should "get the profile" do
|
||||
assert_equal("https://nijie.info/members.php?id=728995", @site.profile_url)
|
||||
end
|
||||
@ -72,6 +80,10 @@ module Sources
|
||||
assert_equal("https://pic03.nijie.info/nijie_picture/728995_20170505014820_0.jpg", @site.image_url)
|
||||
end
|
||||
|
||||
should "get the canonical url" do
|
||||
assert_equal("https://nijie.info/view.php?id=213043", @site.canonical_url)
|
||||
end
|
||||
|
||||
should "get the profile" do
|
||||
assert_equal("https://nijie.info/members.php?id=728995", @site.profile_url)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user