require_relative '../test_config' require 'helix_versioning_engine' describe 'HelixVersioningEngine jobs' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end randstr = (0...8).map { (65 + rand(26)).chr }.join job_id = nil new_job = { 'Job' => 'new', 'User' => 'jdoe', 'Description' => "Test Job #{randstr}", 'Status' => 'open' } context 'POST /helix_versioning_engine/v78/jobs' do it 'can create a new job' do authorize 'super', ticket_for_super post('/helix_versioning_engine/v78/jobs', new_job) expect(last_response.status).to eq(200) end end context 'GET /helix_versioning_engine/v78/jobs' do it 'returns the new job in an array of jobs' do authorize 'super', ticket_for_super get('/helix_versioning_engine/v78/jobs') expect(last_response.status).to eq(200) jobs = JSON.parse(last_response.body) job = jobs.find{ |x| x['Description'].include?(new_job['Description'])} expect(job).to_not be nil job_id = job['Job'] end end context 'GET /helix_versioning_engine/v78/jobs/[job]' do it 'can fetch the new job' do authorize 'super', ticket_for_super get("/helix_versioning_engine/v78/jobs/#{job_id}") expect(last_response.status).to eq(200) job = JSON.parse(last_response.body) expect(job['Description']).to include(new_job['Description']) end end context 'PATCH /helix_versioning_engine/v78/jobs/[job]' do it 'can update the description' do authorize 'super', ticket_for_super patch("/helix_versioning_engine/v78/jobs/#{job_id}", { 'Description' => "Update #{randstr}"}) expect(last_response.status).to eq(200) get("/helix_versioning_engine/v78/jobs/#{job_id}") expect(last_response.status).to eq(200) job = JSON.parse(last_response.body) expect(job['Description']).to include("Update #{randstr}") end end context 'DELETE /helix_versioning_engine/v78/jobs/[job]' do it 'can delete the job' do authorize 'super', ticket_for_super delete("/helix_versioning_engine/v78/jobs/#{job_id}") expect(last_response.status).to eq(200) get('/helix_versioning_engine/v78/jobs') jobs = JSON.parse(last_response.body) expect(jobs.map{|x| x['name']}).to_not include(job_id) end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15741 | ptomiak | Branch HWS for my use. | ||
//guest/perforce_software/helix-web-services/main/source/helix_web_services/spec/helix_versioning_engine/jobs_spec.rb | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services/spec/helix_versioning_engine/jobs_spec.rb | |||||
#2 | 15240 | tjuricek |
Set api level via request path on all Helix Versioning Engine methods. This will allow migration of applications to different P4D versions. Our internal methods (like project API) should attempt to handle backward compatibility similarly. P4WEBAPI-118 |
||
#1 | 15210 | tjuricek | Implement tests and documentation for job spec management. |