# Copyright (c) 2014 Perforce Software, Inc. All rights reserved. require 'rspec' require 'helix_web_services_client' require 'tempfile' require_relative './test_config' RSpec.describe 'HelixWebServicesClient files' do randstr = (0...8).map { (65 + rand(26)).chr }.join context '#files' do it 'should list the depots with no arguments' do client_as_jdoe do |c| depots = c.files expect(depots.map(&:name)).to include('depot') end end it "should list 'dev' and 'main' dirs at the /depot path" do client_as_jdoe do |c| dirs = c.files('depot') dir_names = dirs.map(&:depot_file_or_dir) expect(dir_names).to include('//depot/dev') expect(dir_names).to include('//depot/main') end end it "should list 'README' at the depot/dev/Experimental path" do client_as_jdoe do |c| paths = c.files('depot/dev/Experimental') names = paths.map(&:depot_file_or_dir) expect(names).to include('//depot/dev/Experimental/README') end end end context '#upload_file' do it 'should allow me to upload a new README to depot/dev/Experimental' do client_as_jdoe do |c| c.upload_file( 'DepotFile' => "//depot/dev/Experimental/README-#{randstr}", 'Content' => 'This is the new damn readme!' ) uploaded = c.file("//depot/dev/Experimental/README-#{randstr}") expect(uploaded.content).to eq('This is the new damn readme!') end end end context '#upload_files' do it 'should allow me to upload the README and a new_file to '\ 'depot/dev/Experimental' do client_as_jdoe do |c| c.upload_files( files: [ { 'DepotFile' => 'README', 'Content' => "Readme edit #{randstr}" }, { 'depot_file' => "new_file_#{randstr}", 'content' => 'New file content' } ], path: '//depot/dev/Experimental' ) files = c.files('//depot/dev/Experimental') names = files.map(&:depot_file_or_dir) expect(names).to include('//depot/dev/Experimental/README') expect(names).to include("//depot/dev/Experimental/new_file_#{randstr}") readme_file = c.file('//depot/dev/Experimental/README') expect(readme_file.content).to eq("Readme edit #{randstr}") new_file = c.file("//depot/dev/Experimental/new_file_#{randstr}") expect(new_file.content).to eq('New file content') end end end context '#delete_file' do it 'should allow me to delete a file' do client_as_jdoe do |c| c.delete_file("//depot/dev/Experimental/new_file_#{randstr}") files = c.files('//depot/dev/Experimental') names = files.map(&:depot_file_or_dir) expect(names).to_not include("//depot/dev/Experimental/new_file_#{randstr}") end 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_client/spec/files_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_client/spec/files_spec.rb | |||||
#1 | 15189 | tjuricek | Update files implementation, testing, and documentation. | ||
//guest/perforce_software/helix-web-services/main/helix_web_services_client/spec.old/perforce/files_spec.rb | |||||
#1 | 15053 | tjuricek |
Revise the client API to use the new login method. The current specs will need to be revised since data normalization is moving out of the server and into the client. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services_client/spec/perforce/files_spec.rb | |||||
#1 | 13808 | tjuricek | Finish converting most of the core p4d API into the new monolithic system. |