s3: torture: adjust SMB1 cli_splice() test sizes
[Samba.git] / python / samba / tests / password_quality.py
blob890060e27964018c7f790e77746c654a6f98e7d3
1 # -*- coding: utf-8 -*-
3 # Unix SMB/CIFS implementation.
4 # Copyright (C) Catalyst IT Ltd. 2017
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 """Tests for the python wrapper of the check_password_quality function
21 """
23 from samba import check_password_quality
24 from samba.tests import TestCase, TestCaseInTempDir
26 class PasswordQualityTests(TestCase):
27 def test_check_password_quality(self):
28 self.assertFalse(check_password_quality(""),
29 "empty password")
30 self.assertFalse(check_password_quality("a"),
31 "one char password")
32 self.assertFalse(check_password_quality("aaaaaaaaaaaa"),
33 "same char password")
34 self.assertFalse(check_password_quality("BLA"),
35 "multiple upcases password")
36 self.assertFalse(check_password_quality("123"),
37 "digits only")
38 self.assertFalse(check_password_quality("matthiéu"),
39 "not enough high symbols")
40 self.assertFalse(check_password_quality("abcdééàçè"),
41 "only lower case")
42 self.assertFalse(check_password_quality("abcdééàçè+"),
43 "only lower and symbols")
44 self.assertTrue(check_password_quality("abcdééàçè+ढ"),
45 "valid")
46 self.assertTrue(check_password_quality("ç+ढ"),
47 "valid")
48 self.assertTrue(check_password_quality("A2e"),
49 "valid")
50 self.assertTrue(check_password_quality("BA2eLi443"),
51 "valid")