1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

selftest: add test for User.get_primary_group method

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Rob van der Linde 2024-04-30 23:54:13 +12:00 committed by Andrew Bartlett
parent 8fe7f0a6d5
commit 5aafd2fb40

View File

@ -116,6 +116,21 @@ class ModelTests(SambaToolCmdTest):
self.assertIn("whenCreated", silo_dict)
class UserModelTests(SambaToolCmdTest):
@classmethod
def setUpClass(cls):
cls.samdb = cls.getSamDB("-H", HOST, CREDS)
super().setUpClass()
def test_get_primary_group(self):
jane = User.get(self.samdb, account_name="jane")
domain_sid = self.samdb.domain_sid
expected_group = Group.get(self.samdb,
object_sid=f"{domain_sid}-{jane.primary_group_id}")
self.assertEqual(jane.get_primary_group(self.samdb), expected_group)
class ComputerModelTests(SambaToolCmdTest):
@classmethod