2024-05-12 05:59:38 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-03-08 03:41:45 +01:00
|
|
|
require_relative "../setup"
|
|
|
|
module BSD::Control
|
2024-03-08 05:14:58 +01:00
|
|
|
class FeatureStatusTest < Test::Unit::TestCase
|
2024-05-12 05:59:38 +02:00
|
|
|
require "fileutils"
|
2024-03-08 03:41:45 +01:00
|
|
|
include FileUtils
|
|
|
|
|
2024-03-20 20:25:20 +01:00
|
|
|
def test_pageexec_sysdef_status
|
2024-03-08 03:41:45 +01:00
|
|
|
touch(file)
|
|
|
|
assert_equal :sysdef,
|
2024-03-20 20:25:20 +01:00
|
|
|
BSD::Control.feature(:pageexec).status(file)
|
2024-03-08 03:41:45 +01:00
|
|
|
ensure
|
|
|
|
rm(file)
|
|
|
|
end
|
|
|
|
|
2024-03-20 20:25:20 +01:00
|
|
|
def test_pageexec_enabled_status
|
2024-03-08 03:41:45 +01:00
|
|
|
touch(file)
|
2024-03-20 20:25:20 +01:00
|
|
|
BSD::Control.feature(:pageexec).enable!(file)
|
2024-03-08 03:41:45 +01:00
|
|
|
assert_equal :enabled,
|
2024-03-20 20:25:20 +01:00
|
|
|
BSD::Control.feature(:pageexec).status(file)
|
2024-03-08 03:41:45 +01:00
|
|
|
ensure
|
|
|
|
rm(file)
|
|
|
|
end
|
|
|
|
|
2024-03-20 20:25:20 +01:00
|
|
|
def test_pageexec_disabled_status
|
2024-03-08 03:41:45 +01:00
|
|
|
touch(file)
|
2024-03-20 20:25:20 +01:00
|
|
|
BSD::Control.feature(:pageexec).disable!(file)
|
2024-03-08 03:41:45 +01:00
|
|
|
assert_equal :disabled,
|
2024-03-20 20:25:20 +01:00
|
|
|
BSD::Control.feature(:pageexec).status(file)
|
2024-03-08 03:41:45 +01:00
|
|
|
ensure
|
|
|
|
rm(file)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def file
|
|
|
|
File.join(__dir__, "file")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|