traffic: new version of model with packet_rate, version number
[samba.git] / python / samba / tests / password_quality.py
1 # -*- coding: utf-8 -*-
2
3 # Unix SMB/CIFS implementation.
4 # Copyright (C) Catalyst IT Ltd. 2017
5 #
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.
10 #
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.
15 #
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/>.
18 #
19
20 """Tests for the python wrapper of the check_password_quality function
21 """
22
23 from samba import check_password_quality
24 from samba.tests import TestCase
25
26
27 class PasswordQualityTests(TestCase):
28     def test_check_password_quality(self):
29         self.assertFalse(check_password_quality(""),
30                          "empty password")
31         self.assertFalse(check_password_quality("a"),
32                          "one char password")
33         self.assertFalse(check_password_quality("aaaaaaaaaaaa"),
34                          "same char password")
35         self.assertFalse(check_password_quality("BLA"),
36                          "multiple upcases password")
37         self.assertFalse(check_password_quality("123"),
38                          "digits only")
39         self.assertFalse(check_password_quality("matthiéu"),
40                          "not enough high symbols")
41         self.assertFalse(check_password_quality("abcdééàçè"),
42                          "only lower case")
43         self.assertFalse(check_password_quality("abcdééàçè+"),
44                          "only lower and symbols")
45         self.assertTrue(check_password_quality("abcdééàçè+ढ"),
46                         "valid")
47         self.assertTrue(check_password_quality("ç+ढ"),
48                         "valid")
49         self.assertTrue(check_password_quality("A2e"),
50                         "valid")
51         self.assertTrue(check_password_quality("BA2eLi443"),
52                         "valid")