Fix #5221: Trying to upload an unsupported url shows ai tags error.

This commit is contained in:
evazion
2022-07-01 18:13:36 -05:00
parent a7755a7469
commit 67798c9ece
4 changed files with 33 additions and 4 deletions

View 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