Back to index

moin  1.9.0~rc2
test_multiconfig.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - MoinMoin.config.multiconfig Tests
00004 
00005     @copyright: 2007 by MoinMoin:ThomasWaldmann
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 
00009 import py
00010 from MoinMoin.support.python_compatibility import set
00011 
00012 
00013 class TestPasswordChecker:
00014     username = u"SomeUser"
00015     tests_builtin = [
00016         (u'', False), # empty
00017         (u'1966', False), # too short
00018         (u'asdfghjk', False), # keyboard sequence
00019         (u'QwertZuiop', False), # german keyboard sequence, with uppercase
00020         (u'mnbvcx', False), # reverse keyboard sequence
00021         (u'12345678', False), # keyboard sequence, too easy
00022         (u'aaaaaaaa', False), # not enough different chars
00023         (u'BBBaaaddd', False), # not enough different chars
00024         (username, False), # username == password
00025         (username[1:-1], False), # password in username
00026         (u"XXX%sXXX" % username, False), # username in password
00027         (u'Moin-2007', True), # this should be OK
00028     ]
00029     def testBuiltinPasswordChecker(self):
00030         pw_checker = self.request.cfg.password_checker
00031         if not pw_checker:
00032             py.test.skip("password_checker is disabled in the configuration, not testing it")
00033         else:
00034             for pw, result in self.tests_builtin:
00035                 pw_error = pw_checker(self.request, self.username, pw)
00036                 print "%r: %s" % (pw, pw_error)
00037                 assert result == (pw_error is None)
00038 
00039 coverage_modules = ['MoinMoin.config.multiconfig']
00040