nijie: add canonical url tests.

This commit is contained in:
evazion
2018-08-31 23:23:15 -05:00
parent 736c22c3ce
commit d6235d6f9e
2 changed files with 23 additions and 0 deletions

View File

@@ -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)