bug(api): token, not checked

This commit is contained in:
Martin 2023-01-19 17:33:19 +01:00
parent d566a5e095
commit 7206f1b298

View file

@ -151,6 +151,17 @@ describe API::V2::GraphqlController do
} }
end end
context "when the does not belong to an admin of the procedure" do
let(:another_administrateur) { create(:administrateur) }
before do
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials(APIToken.generate(another_administrateur)[1])
end
it {
expect(gql_errors.first[:message]).to eq("An object of type Demarche was hidden due to permissions")
}
end
context "when the token is revoked" do context "when the token is revoked" do
before do before do
admin.api_tokens.destroy_all admin.api_tokens.destroy_all