BUGFIX: improve error messages for invalid API keys

BUGFIX: don't track last seen for message bus
This commit is contained in:
Sam
2014-05-22 09:01:29 +10:00
parent 7fee3d7f8f
commit eeef775f21
6 changed files with 94 additions and 40 deletions

View File

@ -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