# Copyright (c) 2014 Perforce Software, Inc. All rights reserved. require 'rspec' require 'p4_web_api_client' require 'tempfile' require_relative 'test_connections' RSpec.describe P4WebApiClient::Client, '#files' do it 'should list the depots with no arguments' do client_as_jdoe do |c| depots = c.files expect(depots.length).to be >= (1) expect(depots.first.name).to eq('depot') end end it "should list 'dev' and 'main' dirs at the /depot path" do client_as_jdoe do |c| dirs = c.files('depot') expect(dirs.length).to eq(2) dir_names = dirs.map(&:name) expect(dir_names).to include('dev') expect(dir_names).to include('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(&:name) expect(names).to include('README') end end it "should list 'README' at the depot/dev/.../README path" do client_as_jdoe do |c| paths = c.files('depot/dev/.../README') names = paths.map(&:name) expect(names).to include('README') end end end RSpec.describe P4WebApiClient::Client, '#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( 'depot_file' => '//depot/dev/Experimental/README', 'content' => 'This is the new damn readme!' ) uploaded = c.file('//depot/dev/Experimental/README') expect(uploaded.content).to eq('This is the new damn readme!') end end end RSpec.describe P4WebApiClient::Client, '#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: [ { 'depot_file' => 'README', 'content' => 'Another readme version' }, { 'depot_file' => 'new_file', 'content' => 'New file content' } ], path: '//depot/dev/Experimental' ) files = c.files('//depot/dev/Experimental') names = files.map(&:name) expect(names).to include('README') expect(names).to include('new_file') readme_file = c.file('//depot/dev/Experimental/README') expect(readme_file.content).to eq('Another readme version') new_file = c.file('//depot/dev/Experimental/new_file') expect(new_file.content).to eq('New file content') end end end RSpec.describe P4WebApiClient::Client, '#delete_file' do it 'should allow me to delete depot/dev/Experimental/new_file' do client_as_jdoe do |c| c.delete_file('//depot/dev/Experimental/new_file') files = c.files('//depot/dev/Experimental') names = files.map(&:name) expect(names).to_not include('new_file') end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 13972 | tjuricek |
Removing old microservice implementations. The system is now mostly a monolith. Eventually there will be a websocket service. |
||
#3 | 13481 | tjuricek |
Tests for the p4 web api and p4 project services now pass against a development setup both in and out of the docker cluster. Note that configuration *has not* been finalized, so conventions to dealing with development vs production need to be organized a bit. |
||
#2 | 13474 | tjuricek | Corrected regressions that broke the API and Project services specs. | ||
#1 | 13412 | tjuricek |
Initial version of the web-services mainline. This is a collection of several projects, that will likely often get released together, though many of them may not always be relevant. See the README for more information. |