Files
danbooru/test/functional/mock_services_controller_test.rb
evazion 5c7843bd3d scripts: refactor mocked services.
Replace the mocked services in scripts/mocked_services with Rails-level
mocked services.

The scripts in scripts/mocked_services were a set of stub Sinatra
servers used to mock the Reportbooru, Recommender, and IQDBs services
during development. They return fake data so you can test pages that use
these services.

Implementing these services in Rails makes it easier to run them. It
also lets us drop a dependency on Sinatra and drop a use of HTTParty.

To use these services, set the following configuration in danbooru_local_config.rb
or .env.local:

* reportbooru_server: http://localhost:3000/mock/reportbooru
* recommender_server: http://localhost:3000/mock/recommender
* iqdbs_server: http://localhost:3000/mock/iqdb

where `http://localhost:300` is the url for your local Danbooru server
(may need to be changed depending on your configuration).
2020-06-21 15:11:56 -05:00

29 lines
670 B
Ruby

require 'test_helper'
class MockServicesControllerTest < ActionDispatch::IntegrationTest
context "The mock services controller" do
setup do
create(:post)
create(:tag)
end
context "for all actions" do
should "work" do
paths = [
mock_recommender_recommend_path(42),
mock_recommender_similar_path(42),
mock_reportbooru_missed_searches_path,
mock_reportbooru_post_searches_path,
mock_reportbooru_post_views_path,
mock_iqdbs_similar_path,
]
paths.each do |path|
get path
assert_response :success
end
end
end
end
end