Fix #5221: Trying to upload an unsupported url shows ai tags error.
This commit is contained in:
11
test/test_helpers/autotagger_helper.rb
Normal file
11
test/test_helpers/autotagger_helper.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
module AutotaggerHelper
|
||||
def mock_autotagger_evaluate(tags, http: Danbooru::Http.any_instance)
|
||||
tags.keys.each { |name| create(:tag, name: name) }
|
||||
|
||||
Danbooru.config.stubs(:autotagger_url).returns("http://localhost:5000")
|
||||
body = [{ filename: "test.jpg", tags: tags }]
|
||||
|
||||
response = HTTP::Response.new(status: 200, body: body.to_json, version: "1.1", request: nil, headers: { "Content-Type": "application/json" })
|
||||
http.stubs(:post).with("http://localhost:5000/evaluate", anything).returns(response)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user