Skip to content

Commit

Permalink
testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Apr 17, 2024
1 parent d668e5f commit 1de9c47
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/y2storage/dialogs/guided_setup/select_scheme.rb
Expand Up @@ -150,7 +150,7 @@ def encryption_method_widget
Opt(:notify, :hstretch),
_("Encryption method"),
Y2Storage::EncryptionMethod.available.reject(&:only_for_swap?).map do |m|
Item(Id(m.to_sym), m.to_human_string, false)
Item(Id(m.id), m.to_human_string, (m.id == :luks2))
end
)
)
Expand Down
30 changes: 30 additions & 0 deletions test/y2storage/dialogs/guided_setup/select_scheme_test.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env rspec

# Copyright (c) [2017] SUSE LLC
#
# All Rights Reserved.
Expand Down Expand Up @@ -48,6 +49,7 @@
let(:password) { "" }
let(:repeat_password) { password }
let(:encryption_method) { :luks2 }
let(:encryption_pbkdf) { "pbkdf2" }

context "when settings has not LVM" do
before do
Expand Down Expand Up @@ -218,9 +220,33 @@
select_widget(:password, value: password)
select_widget(:repeat_password, value: repeat_password)
select_widget(:encryption_method, value: encryption_method)
select_widget(:encryption_method, value: encryption_method)
select_widget(:encryption_pbkdf, value: encryption_pbkdf)
settings.encryption_password = nil
end

context "and luks1 is selected" do
before do
select_widget(:encryption_method, value: :luks1)
end

it "disables pbkdf field" do
expect_disable(:encryption_pbkdf)
subject.run
end
end

context "and luks2 is selected" do
before do
select_widget(:encryption_method, value: :luks2)
end

it "enables pbkdf field" do
expect_enable(:encryption_pbkdf)
subject.run
end
end

it "enables password, encryption method fields" do
expect_enable(:password)
expect_enable(:repeat_password)
Expand Down Expand Up @@ -321,6 +347,7 @@
select_widget(:password, value: password)
select_widget(:repeat_password, value: password)
select_widget(:encryption_method, value: encryption_method)
select_widget(:encryption_pbkdf, value: encryption_pbkdf) if encryption_method == :luks2
end

let(:password) { "Val1d_pass" }
Expand All @@ -330,6 +357,9 @@
expect(subject.settings.use_lvm).to eq(true)
expect(subject.settings.encryption_password).to eq(password)
expect(subject.settings.encryption_method.id).to eq(encryption_method)
if encryption_method == :luks2
expect(subject.settings.encryption_pbkdf.value).to eq(encryption_pbkdf)
end
end
end
end
Expand Down

0 comments on commit 1de9c47

Please sign in to comment.