Fix posts controller api test.
1) Failure:
PostsControllerTest#test_: The posts controller for api calls passing the api limit should work. [/home/danbooru/src/danbooru/test/functional/posts_controller_test.rb:34]:
Expected response to be a <429>, but was <200>.
Expected: 429
Actual: 200
This commit is contained in:
@@ -22,6 +22,7 @@ class PostsControllerTest < ActionController::TestCase
|
|||||||
@post = FactoryGirl.create(:post)
|
@post = FactoryGirl.create(:post)
|
||||||
@bucket = TokenBucket.create(user_id: @user.id, token_count: 5, last_touched_at: Time.now)
|
@bucket = TokenBucket.create(user_id: @user.id, token_count: 5, last_touched_at: Time.now)
|
||||||
User.any_instance.stubs(:api_burst_limit).returns(5)
|
User.any_instance.stubs(:api_burst_limit).returns(5)
|
||||||
|
User.any_instance.stubs(:api_regen_multiplier).returns(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "work" do
|
should "work" do
|
||||||
@@ -30,7 +31,7 @@ class PostsControllerTest < ActionController::TestCase
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
post :update, {:format => "json", :id => @post.id, :post => {:rating => "q"}, :login => @user.name, :api_key => @user.api_key.key}
|
post :update, {:format => "json", :id => @post.id, :post => {:rating => "q"}, :login => @user.name, :api_key => @user.api_key.key}
|
||||||
assert_response 429
|
assert_response 429
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user