summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorgideon-kuijt-northwave <gideon.kuijt@northwave-cybersecurity.com>2026-04-07 13:46:41 +0200
committerGitHub <noreply@github.com>2026-04-07 12:46:41 +0100
commit16e6f21de8e90833e2284aeab6cd39d2e1482155 (patch)
tree9c12dc7b817c4e234a6c3a15466372878ba0ea79 /tests
parentfdc70e9ce400c5551b9dd83a7c979ba0db8209ef (diff)
downloadvyos.vyos-16e6f21de8e90833e2284aeab6cd39d2e1482155.tar.gz
vyos.vyos-16e6f21de8e90833e2284aeab6cd39d2e1482155.zip
T8205 Ensure the vyos_user module works when user properties are defined in… (#445)
* Ensure the vyos_user module works when user properties are defined in aggregate Ensure the vyos_user module works when user properties are defined in aggregate. Previously the value variable is not filled when a property is configured as a property of a user. This gives a python error when the value variable is called. * Add unit test for aggregate vyos_user module * Create vyos_user_aggregate_fix.yml Create changelog for vyos_user aggregate bugfix * Rename vyos_user_aggregate_fix.yml to T8205_vyos_user_aggregate_fix.yml * Rename T8205_vyos_user_aggregate_fix.yml to T8205_vyos_user_aggregate_fix.yml Remove unintended whitespace in changelog fragment: T8205_vyos_user_aggregate_fix.yml --------- Co-authored-by: omnom62 <75066712+omnom62@users.noreply.github.com> Co-authored-by: Daniil Baturin <daniil@baturin.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_user.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/unit/modules/network/vyos/test_vyos_user.py b/tests/unit/modules/network/vyos/test_vyos_user.py
index e8c50783..d1e7f162 100644
--- a/tests/unit/modules/network/vyos/test_vyos_user.py
+++ b/tests/unit/modules/network/vyos/test_vyos_user.py
@@ -237,3 +237,43 @@ class TestVyosUserModule(TestVyosModule):
),
)
result = self.execute_module(changed=False)
+
+ def test_vyos_user_aggregate_with_public_keys(self):
+ set_module_args(
+ dict(
+ aggregate=[
+ dict(
+ name="user1",
+ public_keys=[
+ dict(
+ name="user1@host1",
+ key="AAAAC3NzaC1lZDI1NTE5AAAAIFIR0jrMvBdmvTJNY5EDhOD+eixvbOinhY1eBU2u",
+ type="ssh-ed25519",
+ ),
+ ],
+ ),
+ dict(
+ name="user2",
+ public_keys=[
+ dict(
+ name="user2@host2",
+ key="AAAAC3NzaC1lZDI1NTE5AAAAIFIR0jrMvBdmvTJNY5EDhOD+eixvbOinhY1eBU2u",
+ type="ssh-ed25519",
+ ),
+ ],
+ ),
+ ],
+ ),
+ )
+ result = self.execute_module(changed=True)
+ self.assertEqual(
+ sorted(result["commands"]),
+ sorted(
+ [
+ "set system login user user1 authentication public-keys user1@host1 key 'AAAAC3NzaC1lZDI1NTE5AAAAIFIR0jrMvBdmvTJNY5EDhOD+eixvbOinhY1eBU2u'",
+ "set system login user user1 authentication public-keys user1@host1 type 'ssh-ed25519'",
+ "set system login user user2 authentication public-keys user2@host2 key 'AAAAC3NzaC1lZDI1NTE5AAAAIFIR0jrMvBdmvTJNY5EDhOD+eixvbOinhY1eBU2u'",
+ "set system login user user2 authentication public-keys user2@host2 type 'ssh-ed25519'",
+ ],
+ ),
+ )