Skip to content

Commit

Permalink
make rubocop happy and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Dec 4, 2024
1 parent 22b734d commit 4352400
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion service/lib/agama/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def register(code, email: "")
# if service require specific credentials file, store it
@credentials_file = credentials_from_url(@service.url)
if @credentials_file
SUSE::Connect::YaST.create_credentials_file(login, password, File.join(TARGET_DIR, @credentials_file))
SUSE::Connect::YaST.create_credentials_file(login, password,
File.join(TARGET_DIR, @credentials_file))
end
Y2Packager::NewRepositorySetup.instance.add_service(@service.name)
@software.add_service(@service)
Expand Down
7 changes: 4 additions & 3 deletions service/test/agama/registration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

it "creates credentials file" do
expect(SUSE::Connect::YaST).to receive(:create_credentials_file)
.with("test-user", "12345")
.with("test-user", "12345", "/run/agama/zypp/etc/zypp/credentials.d/SCCcredentials")

subject.register("11112222", email: "[email protected]")
end
Expand All @@ -117,13 +117,14 @@

before do
allow(subject).to receive(:credentials_from_url)
.with("https://credentials/file").and_return("credentials")
.with("https://credentials/file")
.and_return("/etc/zypp/credentials.d/product")
end

it "creates the credentials file" do
expect(SUSE::Connect::YaST).to receive(:create_credentials_file)
expect(SUSE::Connect::YaST).to receive(:create_credentials_file)
.with("test-user", "12345", "credentials")
.with("test-user", "12345", "/run/agama/zypp/etc/zypp/credentials.d/product")

subject.register("11112222", email: "[email protected]")
end
Expand Down

0 comments on commit 4352400

Please sign in to comment.