# 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') if !cloud_test? expect(depots.map(&:name)).to include('my_project') if cloud_test? end end it "should list 'dev' and 'main' dirs at the /depot path" do client_as_jdoe do |c| if cloud_test? dirs = c.files('my_project/main') dir_names = dirs.map(&:depot_file_or_dir) expect(dir_names).to include('//my_project/main/dev') expect(dir_names).to include('//my_project/main/main') else 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 end it "should list 'README' at the depot/dev/Experimental path" do client_as_jdoe do |c| skip 'Not available for cloud (no stream support)' if cloud_test? 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 skip 'Not available for cloud (no stream support)' if cloud_test? 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 skip 'Not available for cloud (no stream support)' if cloud_test? 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 skip 'Not available for cloud (no stream support)' if cloud_test? 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 | |
---|---|---|---|---|---|
#4 | 16271 | Doug Scheirer |
- delete the default //depot for cloud tests - mark more tests as pending - refactored sync tests a little to make cloud compatib;e - fixed a bug in the sync 'locked' logic |
||
#3 | 16040 | Doug Scheirer | I think the pending tests is at a minimum for cloud enabled, so readyto integrate up? | ||
#2 | 16026 | Doug Scheirer | Marked last few cloud tests pending, enabled test:cloud by default | ||
#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_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. |