summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/module_utils_Ansible.ModuleUtils.PrivilegeUtil
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2021-11-11 02:04:39 +0100
committerGitHub <noreply@github.com>2021-11-11 02:04:39 +0100
commit9985b8a9756c570811d0f221bc11ffc9354f291f (patch)
tree63c9ade93cd52a860a7537d0f1f7aab53fcad67f /test/integration/targets/module_utils_Ansible.ModuleUtils.PrivilegeUtil
parentDocs: Link to valid data types for role parameters (#76276) (diff)
downloadansible-9985b8a9756c570811d0f221bc11ffc9354f291f.tar.xz
ansible-9985b8a9756c570811d0f221bc11ffc9354f291f.zip
ansible-test pssa update and new rules (#76256)
Diffstat (limited to 'test/integration/targets/module_utils_Ansible.ModuleUtils.PrivilegeUtil')
-rw-r--r--test/integration/targets/module_utils_Ansible.ModuleUtils.PrivilegeUtil/library/privilege_util_test.ps123
1 files changed, 12 insertions, 11 deletions
diff --git a/test/integration/targets/module_utils_Ansible.ModuleUtils.PrivilegeUtil/library/privilege_util_test.ps1 b/test/integration/targets/module_utils_Ansible.ModuleUtils.PrivilegeUtil/library/privilege_util_test.ps1
index e1ca25da81..414b80a9f8 100644
--- a/test/integration/targets/module_utils_Ansible.ModuleUtils.PrivilegeUtil/library/privilege_util_test.ps1
+++ b/test/integration/targets/module_utils_Ansible.ModuleUtils.PrivilegeUtil/library/privilege_util_test.ps1
@@ -5,7 +5,7 @@
$module = [Ansible.Basic.AnsibleModule]::Create($args, @{})
-Function Assert-Equals($actual, $expected) {
+Function Assert-Equal($actual, $expected) {
if ($actual -cne $expected) {
$call_stack = (Get-PSCallStack)[1]
$module.Result.actual = $actual
@@ -70,20 +70,21 @@ foreach ($privilege in $total_privileges) {
$expected = $actual_privileges.$privilege
}
$actual = Get-AnsiblePrivilege -Name $privilege
- Assert-Equals -actual $actual -expected $expected
+ Assert-Equal -actual $actual -expected $expected
}
# test c# GetAllPrivilegeInfo
$actual = [Ansible.Privilege.PrivilegeUtil]::GetAllPrivilegeInfo($process)
-Assert-Equals -actual $actual.GetType().Name -expected 'Dictionary`2'
-Assert-Equals -actual $actual.Count -expected $actual_privileges.Count
+Assert-Equal -actual $actual.GetType().Name -expected 'Dictionary`2'
+Assert-Equal -actual $actual.Count -expected $actual_privileges.Count
foreach ($privilege in $total_privileges) {
if ($actual_privileges.ContainsKey($privilege)) {
$actual_value = $actual.$privilege
if ($actual_privileges.$privilege) {
- Assert-Equals -actual $actual_value.HasFlag([Ansible.Privilege.PrivilegeAttributes]::Enabled) -expected $true
- } else {
- Assert-Equals -actual $actual_value.HasFlag([Ansible.Privilege.PrivilegeAttributes]::Enabled) -expected $false
+ Assert-Equal -actual $actual_value.HasFlag([Ansible.Privilege.PrivilegeAttributes]::Enabled) -expected $true
+ }
+ else {
+ Assert-Equal -actual $actual_value.HasFlag([Ansible.Privilege.PrivilegeAttributes]::Enabled) -expected $false
}
}
}
@@ -93,19 +94,19 @@ Set-AnsiblePrivilege -Name SeUndockPrivilege -Value $false # ensure we start wi
Set-AnsiblePrivilege -Name SeUndockPrivilege -Value $true -WhatIf
$actual = Get-AnsiblePrivilege -Name SeUndockPrivilege
-Assert-Equals -actual $actual -expected $false
+Assert-Equal -actual $actual -expected $false
Set-AnsiblePrivilege -Name SeUndockPrivilege -Value $true
$actual = Get-AnsiblePrivilege -Name SeUndockPrivilege
-Assert-Equals -actual $actual -expected $true
+Assert-Equal -actual $actual -expected $true
Set-AnsiblePrivilege -Name SeUndockPrivilege -Value $false -WhatIf
$actual = Get-AnsiblePrivilege -Name SeUndockPrivilege
-Assert-Equals -actual $actual -expected $true
+Assert-Equal -actual $actual -expected $true
Set-AnsiblePrivilege -Name SeUndockPrivilege -Value $false
$actual = Get-AnsiblePrivilege -Name SeUndockPrivilege
-Assert-Equals -actual $actual -expected $false
+Assert-Equal -actual $actual -expected $false
$module.Result.data = "success"
$module.ExitJson()