Skip to content

Commit

Permalink
Add spec that covers a non-InvalidRequest error in authorize request
Browse files Browse the repository at this point in the history
  • Loading branch information
camero2734 committed Nov 24, 2023
1 parent 6692812 commit 6c5bbe6
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions spec/controllers/authorizations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,50 @@ def query_params
expect(Doorkeeper::AccessToken.count).to eq 0
end
end

context "invalid client_id" do
before do
default_scopes_exist :public
end

it "does not redirect" do
expect { get :new, params: { client_id: "invalid" } }.to raise_error(Doorkeeper::Errors::InvalidRequest)
end
end

context "invalid scope" do
before do
default_scopes_exist :public
end

it "does not redirect" do
expect do
get :new, params: {
client_id: client.uid,
response_type: "token",
scope: "invalid",
redirect_uri: client.redirect_uri,
state: "return-this",
}
end.to raise_error(Doorkeeper::Errors::BaseResponseError)
end
end

context "invalid redirect_uri" do
before do
default_scopes_exist :public
end

it "does not redirect" do
expect do
get :new, params: {
client_id: client.uid,
response_type: "token",
redirect_uri: "invalid",
}
end.to raise_error(Doorkeeper::Errors::BaseResponseError)
end
end
end

describe "GET #new with callbacks" do
Expand Down

0 comments on commit 6c5bbe6

Please sign in to comment.