forked from e621ng/e621ng
[Posts] Fix the iqdb remove job
More faraday fallout. For delete requests, it expects this parameter to be iterable (if present)
This commit is contained in:
parent
c60ee96133
commit
d7ece18a1c
@ -15,9 +15,9 @@ module IqdbProxy
|
|||||||
endpoint.present?
|
endpoint.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def make_request(path, request_type, params = {})
|
def make_request(path, request_type, body = nil)
|
||||||
conn = Faraday.new(Danbooru.config.faraday_options)
|
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
|
rescue Faraday::Error
|
||||||
raise Error, "This service is temporarily unavailable. Please try again later."
|
raise Error, "This service is temporarily unavailable. Please try again later."
|
||||||
end
|
end
|
||||||
|
@ -64,8 +64,9 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
should "remove the post from iqdb" do
|
should "remove the post from iqdb" do
|
||||||
@post.expects(:remove_iqdb_async).once
|
request_stub = stub_request(:delete, "#{IqdbProxy.endpoint}/images/#{@post.id}")
|
||||||
@post.expunge!
|
with_inline_jobs { @post.expunge! }
|
||||||
|
assert_requested request_stub
|
||||||
end
|
end
|
||||||
|
|
||||||
context "that is status locked" do
|
context "that is status locked" do
|
||||||
|
Loading…
Reference in New Issue
Block a user