Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

updates tests

Marcello Rochafd0d2643ba33
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index ef582c2df53..a9418d0dda5 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -93,7 +93,7 @@ class MyController < ApplicationController
if token&.destroy
# TODO i18n this
- flash[:notice] = I18n.t('my.access_tokens.storages.removed')
+ flash[:info] = I18n.t('my.access_tokens.storages.removed')
else
flash[:error] = I18n.t('my.access_tokens.storages.failed')
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 78feffa54c8..2f3a1760220 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1567,7 +1567,8 @@ en:
text_hint: "File Storage tokens connect this OpenProject instance with an external File Storage."
empty_text_hint: "There is no storage access linked to your account."
revoke_token: "Do you really want to remove this token? You will need to login again on %{storage}"
-
+ removed: "File Storage token successfully removed"
+ failed: "An error occurred and the token couldn't be removed. Please try again later."
notifications:
send_notifications: "Send notifications for this action"
diff --git a/spec/controllers/my_controller_spec.rb b/spec/controllers/my_controller_spec.rb
index aabd7911424..d962f805b5f 100644
--- a/spec/controllers/my_controller_spec.rb
+++ b/spec/controllers/my_controller_spec.rb
@@ -359,7 +359,15 @@ RSpec.describe MyController do
expect(response.body).to have_selector("#storage-oauth-token-#{token.id}")
end
- it 'can remove the token'
+ it 'can remove the token' do
+ expect do
+ delete :delete_storage_token, params: { id: token.id }
+ end.to change(OAuthClientToken, :count).by(-1)
+
+ expect(flash[:info]).to be_present
+ expect(flash[:error]).not_to be_present
+ expect(response).to redirect_to(action: :access_token)
+ end
end
end
end