iqdb: switch to Danbooru::Http.
This commit is contained in:
@@ -21,11 +21,9 @@ module IqdbTestHelper
|
||||
Danbooru.config.stubs(:iqdbs_server).returns("http://localhost:3004")
|
||||
end
|
||||
|
||||
def mock_iqdb_matches!(post_or_source, matches)
|
||||
source = post_or_source.is_a?(Post) ? post_or_source.preview_file_url : post_or_source
|
||||
url = "http://localhost:3004/similar?key=hunter2&url=#{CGI.escape source}&ref"
|
||||
body = matches.map { |post| { post_id: post.id } }.to_json
|
||||
|
||||
stub_request(:get, url).to_return(body: body)
|
||||
def mock_iqdb_matches(matches)
|
||||
Danbooru.config.stubs(:iqdbs_server).returns("http://localhost:3004")
|
||||
response = HTTP::Response.new(status: 200, body: matches.to_json, headers: { "Content-Type": "application/json" }, version: "1.1")
|
||||
HTTP::Client.any_instance.stubs(:post).returns(response)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user