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
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(""),
30 self
.assertFalse(check_password_quality("a"),
32 self
.assertFalse(check_password_quality("aaaaaaaaaaaa"),
34 self
.assertFalse(check_password_quality("BLA"),
35 "multiple upcases password")
36 self
.assertFalse(check_password_quality("123"),
38 self
.assertFalse(check_password_quality("matthiéu"),
39 "not enough high symbols")
40 self
.assertFalse(check_password_quality("abcdééàçè"),
42 self
.assertFalse(check_password_quality("abcdééàçè+"),
43 "only lower and symbols")
44 self
.assertTrue(check_password_quality("abcdééàçè+ढ"),
46 self
.assertTrue(check_password_quality("ç+ढ"),
48 self
.assertTrue(check_password_quality("A2e"),
50 self
.assertTrue(check_password_quality("BA2eLi443"),