bsdcontrol.rb/test/superuser/disable_feature_test.rb

34 lines
717 B
Ruby
Raw Normal View History

2024-05-12 05:59:38 +02:00
# frozen_string_literal: true
2024-03-09 23:40:42 +01:00
require_relative "../setup"
module BSD::Control
class DisableFeatureTest < Test::Unit::TestCase
2024-05-12 05:59:38 +02:00
require "fileutils"
2024-03-09 23:40:42 +01:00
include FileUtils
def test_disable_pageexec
touch(file)
assert BSD::Control.feature(:pageexec).disable!(file),
"The disable! method should have returned true"
assert_equal(
:disabled,
BSD::Control.feature(:pageexec).status(file)
)
ensure
rm(file)
end
def test_disable_pageexec_nonexistent_file
2024-03-10 14:57:39 +01:00
assert_raises(Errno::ENOENT) do
BSD::Control.feature(:pageexec).disable!(file)
2024-03-09 23:40:42 +01:00
end
end
private
def file
File.join(__dir__, "file")
end
end
end