1 # Unix SMB/CIFS implementation. Tests for dsdb
2 # Copyright (C) Andrew Bartlett <abartlet@samba.org> 2021
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 """Tests for samba.dsdb."""
20 from samba
.tests
import TestCase
, DynamicTestCase
21 from samba
.dsdb
import user_account_control_flag_bit_to_string
26 class DsdbFlagTests(TestCase
):
29 def setUpDynamicTestCases(cls
):
31 for x
in dir(samba
.dsdb
):
32 if x
.startswith("UF_"):
33 cls
.generate_dynamic_test("test",
36 getattr(samba
.dsdb
, x
))
39 def _test_with_args(self
, uf_string
, uf_bit
):
40 self
.assertEqual(user_account_control_flag_bit_to_string(uf_bit
),
44 def test_not_a_flag(self
):
45 self
.assertRaises(KeyError,
46 user_account_control_flag_bit_to_string
,
49 def test_too_long(self
):
50 self
.assertRaises(OverflowError,
51 user_account_control_flag_bit_to_string
,
54 def test_way_too_long(self
):
55 self
.assertRaises(OverflowError,
56 user_account_control_flag_bit_to_string
,