-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf0fa83
commit 464a0a2
Showing
9 changed files
with
210 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
service/test/agama/dbus/storage/interfaces/device/device_examples.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) [2024] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require_relative "../../../../../test_helper" | ||
require "y2storage/device_description" | ||
|
||
shared_examples "Device interface" do | ||
describe "Device D-Bus interface" do | ||
let(:scenario) { "partitioned_md.yml" } | ||
|
||
let(:device) { devicegraph.find_by_name("/dev/sda") } | ||
|
||
describe "#device_sid" do | ||
before do | ||
allow(device).to receive(:sid).and_return(123) | ||
end | ||
|
||
it "returns the SID of the device" do | ||
expect(subject.device_sid).to eq(123) | ||
end | ||
end | ||
|
||
describe "#device_name" do | ||
it "returns the name of the device" do | ||
expect(subject.device_name).to eq("/dev/sda") | ||
end | ||
end | ||
|
||
describe "#device_description" do | ||
before do | ||
allow(Y2Storage::DeviceDescription).to receive(:new).with(device).and_return(description) | ||
end | ||
|
||
let(:description) { instance_double(Y2Storage::DeviceDescription, to_s: "test") } | ||
|
||
it "returns the description of the device" do | ||
expect(subject.device_description).to eq("test") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
service/test/agama/dbus/storage/interfaces/device/partition_examples.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) [2024] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require_relative "../../../../../test_helper" | ||
|
||
shared_examples "Partition interface" do | ||
describe "Partition D-Bus interface" do | ||
let(:scenario) { "partitioned_md.yml" } | ||
|
||
let(:device) { devicegraph.find_by_name("/dev/sda1") } | ||
|
||
describe "#partition_device" do | ||
it "returns the path of the host device" do | ||
sda = devicegraph.find_by_name("/dev/sda") | ||
|
||
expect(subject.partition_device).to eq(tree.path_for(sda)) | ||
end | ||
end | ||
|
||
describe "#partition_efi" do | ||
before do | ||
allow(device).to receive(:efi_system?).and_return(true) | ||
end | ||
|
||
it "returns whether it is an EFI partition" do | ||
expect(subject.partition_efi).to eq(true) | ||
end | ||
end | ||
end | ||
end |