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
27 class PasswordQualityTests(TestCase
):
28 def test_check_password_quality(self
):
29 self
.assertFalse(check_password_quality(""),
31 self
.assertFalse(check_password_quality("a"),
33 self
.assertFalse(check_password_quality("aaaaaaaaaaaa"),
35 self
.assertFalse(check_password_quality("BLA"),
36 "multiple upcases password")
37 self
.assertFalse(check_password_quality("123"),
39 self
.assertFalse(check_password_quality("matthiéu"),
40 "not enough high symbols")
41 self
.assertFalse(check_password_quality("abcdééàçè"),
43 self
.assertFalse(check_password_quality("abcdééàçè+"),
44 "only lower and symbols")
45 self
.assertTrue(check_password_quality("abcdééàçè+ढ"),
47 self
.assertTrue(check_password_quality("ç+ढ"),
49 self
.assertTrue(check_password_quality("A2e"),
51 self
.assertTrue(check_password_quality("BA2eLi443"),