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 b9c0155
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions service/lib/agama/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
module Agama
# Handles everything related to registration of system to SCC, RMT or similar.
class Registration

# Note: identical and keep in sync with Software::Manager::TARGET_DIR
# NOTE: identical and keep in sync with Software::Manager::TARGET_DIR
TARGET_DIR = "/run/agama/zypp"
private_constant :TARGET_DIR

Expand Down Expand Up @@ -95,7 +94,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 b9c0155

Please sign in to comment.