From 7e2c7cc70acfdd71c64a8d9c0b6ea365a65ac1d5 Mon Sep 17 00:00:00 2001
From: Watson Sato <wsato@redhat.com>
Date: Thu, 10 Nov 2022 14:01:17 +0100
Subject: [PATCH 2/2] accounts_password: Add tests for conflicting and
duplicate values
Add tests for conflicting and duplicate values
---
.../accounts_password/tests/conflicting_values.fail.sh | 8 ++++++++
.../accounts_password/tests/duplicated_values.pass.sh | 7 +++++++
2 files changed, 15 insertions(+)
create mode 100644 shared/templates/accounts_password/tests/conflicting_values.fail.sh
create mode 100644 shared/templates/accounts_password/tests/duplicated_values.pass.sh
diff --git a/shared/templates/accounts_password/tests/conflicting_values.fail.sh b/shared/templates/accounts_password/tests/conflicting_values.fail.sh
new file mode 100644
index 00000000000..3517ff43083
--- /dev/null
+++ b/shared/templates/accounts_password/tests/conflicting_values.fail.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+# variables = var_password_pam_{{{ VARIABLE }}}={{{ TEST_VAR_VALUE }}}
+
+truncate -s 0 /etc/security/pwquality.conf
+
+echo "{{{ VARIABLE }}} = {{{ TEST_CORRECT_VALUE }}}" >> /etc/security/pwquality.conf
+
+echo "{{{ VARIABLE }}} = {{{ TEST_WRONG_VALUE }}}" >> /etc/security/pwquality.conf
diff --git a/shared/templates/accounts_password/tests/duplicated_values.pass.sh b/shared/templates/accounts_password/tests/duplicated_values.pass.sh
new file mode 100644
index 00000000000..e7b7f957d3d
--- /dev/null
+++ b/shared/templates/accounts_password/tests/duplicated_values.pass.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+# variables = var_password_pam_{{{ VARIABLE }}}={{{ TEST_VAR_VALUE }}}
+
+truncate -s 0 /etc/security/pwquality.conf
+
+echo "{{{ VARIABLE }}} = {{{ TEST_CORRECT_VALUE }}}" >> /etc/security/pwquality.conf
+echo "{{{ VARIABLE }}} = {{{ TEST_CORRECT_VALUE }}}" >> /etc/security/pwquality.conf