Skip to content

Commit

Permalink
Merge pull request #18131 from jerryk55/fix_merged_uri
Browse files Browse the repository at this point in the history
Fix Exception due to missing #merged_uri parameters in FileDepot parent class

(cherry picked from commit 2357413)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1643106
  • Loading branch information
carbonin authored and simaishi committed Oct 26, 2018
1 parent ec64282 commit 5d09d80
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/file_depot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def upload_file(file)
@file = file
end

def merged_uri
def merged_uri(_uri, _api_port)
uri
end
end
13 changes: 12 additions & 1 deletion spec/models/file_depot_ftp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
end

let(:connection) { double("FtpConnection") }
let(:file_depot_ftp) { FileDepotFtp.new(:uri => "ftp://server.example.com/uploads") }
let(:uri) { "ftp://server.example.com/uploads" }
let(:file_depot_ftp) { FileDepotFtp.new(:uri => uri) }
let(:log_file) { LogFile.new(:resource => @miq_server, :local_file => "/tmp/file.txt") }
let(:ftp_mock) do
Class.new do
Expand Down Expand Up @@ -115,4 +116,14 @@ def putbinaryfile(local_path, remote_path)
file_depot_ftp.upload_file(log_file)
end
end

context "#merged_uri" do
before do
file_depot_ftp.uri = uri
end

it "should return the uri attribute from the file depot object and ignore the parameter" do
expect(file_depot_ftp.merged_uri(nil, nil)).to eq uri
end
end
end
23 changes: 23 additions & 0 deletions spec/models/file_depot_nfs_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
describe FileDepotNfs do
let(:uri) { "nfs://foo.com/directory" }
let(:swift_uri) { "swift://foo_bucket/doo_directory" }
let(:file_depot_nfs) { FileDepotNfs.new(:uri => uri) }

it "should return a valid prefix" do
expect(FileDepotNfs.uri_prefix).to eq "nfs"
end

describe "#merged_uri" do
before do
file_depot_nfs.uri = uri
end

it "should return the uri set on the depot object and ignore the uri parameter" do
expect(file_depot_nfs.merged_uri(swift_uri, nil)).to eq uri
end

it "should return the uri set on the depot object and ignore an empty uri parameter" do
expect(file_depot_nfs.merged_uri(nil, nil)).to eq uri
end
end
end

0 comments on commit 5d09d80

Please sign in to comment.