winrm 1.3.0.dev.2 → 1.3.0.dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +0,0 @@
1
- describe WinRM::RemoteZipFile, :integration => true do
2
-
3
- let(:this_dir) { File.dirname(__FILE__) }
4
- let(:service) { winrm_connection }
5
- let(:destination) {"#{ENV['temp']}/WinRM_tests"}
6
- before { FileUtils.rm_rf(Dir.glob("#{ENV['temp'].gsub("\\","/")}/WinRM_*")) }
7
- after { subject.close }
8
- subject {WinRM::RemoteZipFile.new(service, destination, :quiet => true)}
9
-
10
- context 'Upload a new directory' do
11
- it 'copies the directory' do
12
- subject.add_file(this_dir)
13
- expect(subject.upload).to be > 0
14
- expect(File.read(File.join(destination, "file_transfer", "remote_file_spec.rb"))).to eq(File.read(File.join(this_dir, 'remote_file_spec.rb')))
15
- expect(File.read(File.join(destination, "file_transfer", "remote_zip_file_spec.rb"))).to eq(File.read(File.join(this_dir, 'remote_zip_file_spec.rb')))
16
- expect(File.exist?(File.join(this_dir, "file_transfer.zip"))).to be_falsey
17
- expect(File.exist?(File.join(destination, "file_transfer.zip"))).to be_falsey
18
- end
19
- end
20
-
21
- context 'Upload an identical directory' do
22
- let (:next_transfer) {WinRM::RemoteZipFile.new(service, destination, :quiet => true)}
23
-
24
- it 'does not copy the directory' do
25
- subject.add_file(this_dir)
26
- expect(subject.upload).to be > 0
27
- next_transfer.add_file(this_dir)
28
- expect(next_transfer.upload).to be == 0
29
- end
30
- end
31
-
32
- context 'Upload multiple entries' do
33
- it 'copies each entry' do
34
- subject.add_file(this_dir)
35
- spec_helper = File.join(File.dirname(this_dir), 'spec_helper.rb')
36
- subject.add_file(spec_helper)
37
- expect(subject.upload).to be > 0
38
- expect(File.read(File.join(destination, "file_transfer", "remote_file_spec.rb"))).to eq(File.read(File.join(this_dir, 'remote_file_spec.rb')))
39
- expect(File.read(File.join(destination, "file_transfer", "remote_zip_file_spec.rb"))).to eq(File.read(File.join(this_dir, 'remote_zip_file_spec.rb')))
40
- expect(File.read(File.join(destination, "spec_helper.rb"))).to eq(File.read(spec_helper))
41
- end
42
- end
43
-
44
- context 'Upload a bad path' do
45
- it 'raises WinRMUploadFailed' do
46
- expect {
47
- subject.add_file('c:/some/bad/path')
48
- }.to raise_error(WinRM::WinRMUploadFailed)
49
- end
50
- end
51
- end
@@ -1,39 +0,0 @@
1
- describe WinRM::FileTransfer, :unit => true do
2
-
3
- let(:this_file) { __FILE__ }
4
- let(:remote_file) {double('RemoteFile')}
5
- let(:remote_zip_file) {double('RemoteZipFile')}
6
-
7
- before {
8
- allow(WinRM::RemoteFile).to receive(:new).and_return(remote_file)
9
- allow(WinRM::RemoteZipFile).to receive(:new).and_return(remote_zip_file)
10
- }
11
- subject {WinRM::FileTransfer}
12
-
13
- context 'copying a single file' do
14
- it 'uploads a remote_file' do
15
- expect(remote_file).to receive(:upload)
16
- expect(remote_file).to receive(:close)
17
- subject.upload("service", this_file, "c:/directory")
18
- end
19
- end
20
-
21
- context 'copying a single directory' do
22
- it 'uploads a remote_zip_file' do
23
- expect(remote_zip_file).to receive(:add_file).with(File.dirname(this_file))
24
- expect(remote_zip_file).to receive(:upload)
25
- expect(remote_zip_file).to receive(:close)
26
- subject.upload("service", File.dirname(this_file), "c:/directory")
27
- end
28
- end
29
-
30
- context 'copying both a file and a directory' do
31
- it 'adds both to a remote_zip_file' do
32
- expect(remote_zip_file).to receive(:upload)
33
- expect(remote_zip_file).to receive(:add_file).with(this_file)
34
- expect(remote_zip_file).to receive(:add_file).with(File.dirname(this_file))
35
- expect(remote_zip_file).to receive(:close)
36
- subject.upload("service", [File.dirname(this_file), this_file], "c:/directory")
37
- end
38
- end
39
- end