require_relative './test_config' class TestApp < Sinatra::Base get '/test/system_error' do fail P4Error.new(1234, P4::E_FATAL, 'severe problem') end get '/test/user_error' do fail P4Error.new(1234, P4::E_FAILED, 'test error') end end describe 'HelixWebServices' do include Rack::Test::Methods def app HelixWebServices::Master.register_app(TestApp) HelixWebServices::Master end it 'should return a 500 status with a system error' do authorize 'jdoe', ticket_for_jdoe get '/test/system_error' expect(last_response.status).to eq(500) end it 'should return a 400 status with a user error' do authorize 'jdoe', ticket_for_jdoe get '/test/user_error' expect(last_response.status).to eq(400) end it 'should not allow "rsh:" in P4PORT' do # Whatever we do during setup of the cloud tests triggers our error handlers skip('cloud mode triggers error handling') if Cloud::Settings.cloud_enabled? authorize 'jdoe', ticket_for_jdoe header 'X-Perforce-Helix-Web-Services-P4PORT', 'rsh://examplehingy' expect { get '/p4/v78/files' }.to raise_error(P4Error) end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 16318 | Doug Scheirer | merge from main | ||
#5 | 16114 | Doug Scheirer | Merge from main | ||
#4 | 16024 | Doug Scheirer | Some cloud spec forking, got the mock_raymond to spin up in cloud testing, split normal vs cloud spec output | ||
#3 | 15848 | Doug Scheirer | Test environment weirdness | ||
#2 | 15845 | Doug Scheirer | Integ from main | ||
#1 | 15688 | Doug Scheirer |
Populate -o //guest/perforce_software/helix-web-services/... //guest/doug_scheirer/helix-web-services/.... |
||
//guest/perforce_software/helix-web-services/main/source/helix_web_services/spec/helix_web_services_spec.rb | |||||
#1 | 15687 | tjuricek |
Associate 400 status codes for severity 3 exceptions and 500 for severity 4. We don't throw P4Exception for severity < 3 at the moment, since those are typically just warnings, like "you have no files in that directory". |