diff options
| author | David Mulder <dmulder@samba.org> | 2023-01-13 09:07:38 -0700 |
|---|---|---|
| committer | Andrew Bartlett <abartlet@samba.org> | 2023-02-03 02:27:32 +0000 |
| commit | 5723737ebb12d1f6d13863b685bbbd362026dc69 (patch) | |
| tree | 3ffc64c07f226faaf33cfa5cd0c5480e5c2efb7a /python | |
| parent | 3eee4415bca6645e35da93d15d399ac85db9c126 (diff) | |
| download | samba-5723737ebb12d1f6d13863b685bbbd362026dc69.tar.gz samba-5723737ebb12d1f6d13863b685bbbd362026dc69.tar.bz2 samba-5723737ebb12d1f6d13863b685bbbd362026dc69.zip | |
gp: Test samba-tool gpo cse register/unregister/list
Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
| -rw-r--r-- | python/samba/tests/samba_tool/gpo.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/python/samba/tests/samba_tool/gpo.py b/python/samba/tests/samba_tool/gpo.py index ae19a573711..d192c1b8115 100644 --- a/python/samba/tests/samba_tool/gpo.py +++ b/python/samba/tests/samba_tool/gpo.py @@ -34,6 +34,8 @@ from io import StringIO import xml.etree.ElementTree as etree from tempfile import NamedTemporaryFile from time import sleep +import re +from samba.gp.gpclass import check_guid gpo_load_json = \ b""" @@ -1658,6 +1660,39 @@ class GpoCmdTestCase(SambaToolCmdTest): self.assertNotIn(ext_guids[0], out, 'Machine extension not unloaded') self.assertNotIn(ext_guids[1], out, 'User extension not unloaded') + def test_cse_register_unregister_list(self): + with NamedTemporaryFile() as f: + (result, out, err) = self.runsublevelcmd("gpo", ("cse", + "register"), + f.name, 'gp_test_ext', + '--machine') + self.assertCmdSuccess(result, out, err, 'CSE register failed') + + (result, out, err) = self.runsublevelcmd("gpo", ("cse", + "list")) + self.assertIn(f.name, out, 'The test cse was not found') + self.assertIn('ProcessGroupPolicy : gp_test_ext', out, + 'The test cse was not found') + self.assertIn('MachinePolicy : True', out, + 'The test cse was not enabled') + self.assertIn('UserPolicy : False', out, + 'The test cse should not have User policy enabled') + cse_ext = re.findall('^UniqueGUID\s+:\s+(.*)', out) + self.assertEquals(len(cse_ext), 1, + 'The test cse GUID was not found') + cse_ext = cse_ext[0] + self.assertTrue(check_guid(cse_ext), + 'The test cse GUID was not formatted correctly') + + (result, out, err) = self.runsublevelcmd("gpo", ("cse", + "unregister"), + cse_ext) + self.assertCmdSuccess(result, out, err, 'CSE unregister failed') + + (result, out, err) = self.runsublevelcmd("gpo", ("cse", + "list")) + self.assertNotIn(f.name, out, 'The test cse was still found') + def setUp(self): """set up a temporary GPO to work with""" super(GpoCmdTestCase, self).setUp() |
