diff options
Diffstat (limited to 'spec/routing')
-rw-r--r-- | spec/routing/routing_spec.rb | 21 | ||||
-rw-r--r-- | spec/routing/uploads_routing_spec.rb | 95 |
2 files changed, 87 insertions, 29 deletions
diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 7c4f040266e..8b54bc443da 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -122,7 +122,6 @@ end # profile_account GET /-/profile/account(.:format) profile#account # profile_history GET /-/profile/history(.:format) profile#history -# profile_password PUT /-/profile/password(.:format) profile#password_update # profile_token GET /-/profile/token(.:format) profile#token # profile GET /-/profile(.:format) profile#show # profile_update PUT /-/profile/update(.:format) profile#update @@ -131,10 +130,6 @@ RSpec.describe ProfilesController, "routing" do expect(get("/-/profile/account")).to route_to('profiles/accounts#show') end - it "to #audit_log" do - expect(get("/-/profile/audit_log")).to route_to('profiles#audit_log') - end - it "to #reset_feed_token" do expect(put("/-/profile/reset_feed_token")).to route_to('profiles#reset_feed_token') end @@ -397,3 +392,19 @@ RSpec.describe JwksController, "routing" do expect(get('/-/jwks')).to route_to('jwks#index') end end + +# user_settings_authentication_log GET /-/user_settings/authentication_log(.:format) user_settings/user_settings#authentication_log + +RSpec.describe UserSettings::UserSettingsController, 'routing', feature_category: :system_access do + it 'to #authentication_log' do + expect(get('/-/user_settings/authentication_log')).to route_to('user_settings/user_settings#authentication_log') + end +end + +# user_settings_active_sessions_log GET /-/user_settings_active_sessions_log(.:format) user_settings/active_sessions#index# + +RSpec.describe UserSettings::ActiveSessionsController, 'routing', feature_category: :system_access do + it 'to #index' do + expect(get('/-/user_settings/active_sessions')).to route_to('user_settings/active_sessions#index') + end +end diff --git a/spec/routing/uploads_routing_spec.rb b/spec/routing/uploads_routing_spec.rb index 198cda59357..63840b4c30b 100644 --- a/spec/routing/uploads_routing_spec.rb +++ b/spec/routing/uploads_routing_spec.rb @@ -3,37 +3,84 @@ require 'spec_helper' RSpec.describe 'Uploads', 'routing' do - it 'allows creating uploads for personal snippets' do - expect(post('/uploads/personal_snippet?id=1')).to route_to( - controller: 'uploads', - action: 'create', - model: 'personal_snippet', - id: '1' - ) + context 'for personal snippets' do + it 'allows creating uploads for personal snippets' do + expect(post('/uploads/personal_snippet?id=1')).to route_to( + controller: 'uploads', + action: 'create', + model: 'personal_snippet', + id: '1' + ) + end + end + + context 'for users' do + it 'allows creating uploads for users' do + expect(post('/uploads/user?id=1')).to route_to( + controller: 'uploads', + action: 'create', + model: 'user', + id: '1' + ) + end end - it 'allows creating uploads for users' do - expect(post('/uploads/user?id=1')).to route_to( - controller: 'uploads', - action: 'create', - model: 'user', - id: '1' - ) + context 'for abuse reports' do + it 'allows fetching uploaded files for abuse reports' do + expect(get('/uploads/-/system/abuse_report/1/secret/test.png')).to route_to( + controller: 'uploads', + action: 'show', + model: 'abuse_report', + id: '1', + secret: 'secret', + filename: 'test.png' + ) + end + + it 'allows creating uploads for abuse reports' do + expect(post('/uploads/abuse_report?id=1')).to route_to( + controller: 'uploads', + action: 'create', + model: 'abuse_report', + id: '1' + ) + end + + it 'allows authorizing uploads for abuse reports' do + expect(post('/uploads/abuse_report/authorize')).to route_to( + controller: 'uploads', + action: 'authorize', + model: 'abuse_report' + ) + end + + it 'allows fetching abuse report screenshots' do + expect(get('/uploads/-/system/abuse_report/screenshot/1/test.jpg')).to route_to( + controller: 'uploads', + action: 'show', + model: 'abuse_report', + id: '1', + filename: 'test.jpg', + mounted_as: 'screenshot' + ) + end end - it 'allows fetching alert metric metric images' do - expect(get('/uploads/-/system/alert_management_metric_image/file/1/test.jpg')).to route_to( - controller: 'uploads', - action: 'show', - model: 'alert_management_metric_image', - id: '1', - filename: 'test.jpg', - mounted_as: 'file' - ) + context 'for alert management' do + it 'allows fetching alert metric metric images' do + expect(get('/uploads/-/system/alert_management_metric_image/file/1/test.jpg')).to route_to( + controller: 'uploads', + action: 'show', + model: 'alert_management_metric_image', + id: '1', + filename: 'test.jpg', + mounted_as: 'file' + ) + end end it 'does not allow creating uploads for other models' do - unroutable_models = UploadsController::MODEL_CLASSES.keys.compact - %w[personal_snippet user] + unroutable_models = UploadsController::MODEL_CLASSES.keys.compact - %w[personal_snippet user abuse_report] unroutable_models.each do |model| expect(post("/uploads/#{model}?id=1")).not_to be_routable |