diff --git a/app/logical/iqdb_proxy.rb b/app/logical/iqdb_proxy.rb index fb23bfec1..79a77bf31 100644 --- a/app/logical/iqdb_proxy.rb +++ b/app/logical/iqdb_proxy.rb @@ -15,9 +15,9 @@ module IqdbProxy endpoint.present? end - def make_request(path, request_type, params = {}) + def make_request(path, request_type, body = nil) conn = Faraday.new(Danbooru.config.faraday_options) - conn.send(request_type, endpoint + path, params.to_json, { content_type: "application/json" }) + conn.send(request_type, endpoint + path, body&.to_json, { content_type: "application/json" }) rescue Faraday::Error raise Error, "This service is temporarily unavailable. Please try again later." end diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index dce976eb1..9f8f8624c 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -64,8 +64,9 @@ class PostTest < ActiveSupport::TestCase end should "remove the post from iqdb" do - @post.expects(:remove_iqdb_async).once - @post.expunge! + request_stub = stub_request(:delete, "#{IqdbProxy.endpoint}/images/#{@post.id}") + with_inline_jobs { @post.expunge! } + assert_requested request_stub end context "that is status locked" do