mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
Revert "Revert "BUGFIX: improve error messages for invalid API keys""
This reverts commit e9afe28586cd887b92fa86c52db78d543a70e433.
This commit is contained in:
@ -163,16 +163,14 @@ describe 'api' do
|
||||
|
||||
it 'disallows phonies to bookmark posts' do
|
||||
PostAction.expects(:act).with(user, post, PostActionType.types[:bookmark]).never
|
||||
lambda do
|
||||
put :bookmark, bookmarked: "true", post_id: post.id, api_key: SecureRandom.hex(32), api_username: user.username, format: :json
|
||||
end.should raise_error Discourse::NotLoggedIn
|
||||
put :bookmark, bookmarked: "true", post_id: post.id, api_key: SecureRandom.hex(32), api_username: user.username, format: :json
|
||||
response.code.to_i.should == 403
|
||||
end
|
||||
|
||||
it 'disallows blank api' do
|
||||
PostAction.expects(:act).with(user, post, PostActionType.types[:bookmark]).never
|
||||
lambda do
|
||||
put :bookmark, bookmarked: "true", post_id: post.id, api_key: "", api_username: user.username, format: :json
|
||||
end.should raise_error Discourse::NotLoggedIn
|
||||
put :bookmark, bookmarked: "true", post_id: post.id, api_key: "", api_username: user.username, format: :json
|
||||
response.code.to_i.should == 403
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user