Skip to content

Commit

Permalink
More suseconnect-ng related test updates
Browse files Browse the repository at this point in the history
Credentials reading had to be mocked differently after last fix.
  • Loading branch information
skazi0 committed Nov 30, 2021
1 parent 0b7a211 commit 56e073e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions test/registration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@
expect(Registration::SwMgmt).to receive(:update_product_renames)
.with("SUSE_SLES_SAP" => "SLES_SAP")

allow(File).to receive(:exist?).with(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
.and_return(true)

allow(File).to receive(:read).with(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
.and_return("username=SCC_foo\npassword=bar")
allow(SUSE::Connect::YaST).to receive(:credentials)
.with(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
.and_return(OpenStruct.new(username: "SCC_foo", password: "bar"))
end

it "adds the selected product and returns added zypp services" do
Expand All @@ -82,10 +80,6 @@
allow(Yast::Stage).to receive(:initial).and_return(false)
expect(Yast::Installation).to_not receive(:destdir)

expect(SUSE::Connect::YaST).to receive(:credentials)
.with(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
.and_return(OpenStruct.new(username: "SCC_foo", password: "bar"))

subject.send(yast_method, product)
end
end
Expand Down

0 comments on commit 56e073e

Please sign in to comment.