2004-12-26 16:50:53 +01:00
|
|
|
import gnuviech, sys
|
2004-12-26 00:09:19 +01:00
|
|
|
import gnuviech.tools
|
2004-12-26 20:29:32 +01:00
|
|
|
from gnuviech.gnvdomain import GNVDomain
|
2004-12-26 00:09:19 +01:00
|
|
|
|
2004-12-26 16:50:53 +01:00
|
|
|
class Test:
|
|
|
|
def __init__(self, prefs):
|
|
|
|
self.logger = prefs.getLogger(self)
|
|
|
|
self.prefs = prefs
|
|
|
|
|
|
|
|
def doTest(self):
|
|
|
|
self.logger.debug(str(prefs))
|
|
|
|
minlen = 0
|
|
|
|
avglen = 0
|
|
|
|
maxlen = 0
|
|
|
|
pwds = 20
|
|
|
|
for i in range(pwds):
|
|
|
|
pwd = gnuviech.tools.generatePassword()
|
|
|
|
self.logger.debug("%02d: %s (%d)" % (i, pwd, len(pwd)))
|
|
|
|
if (minlen == 0) or (len(pwd) < minlen): minlen = len(pwd)
|
|
|
|
if (len(pwd) > maxlen): maxlen = len(pwd)
|
|
|
|
avglen += len(pwd)
|
|
|
|
avglen = avglen/pwds
|
|
|
|
self.logger.debug("""average password length: %d
|
2004-12-26 00:09:19 +01:00
|
|
|
minimum password length: %d
|
2004-12-26 16:50:53 +01:00
|
|
|
maximum password length: %d""" % (avglen, minlen, maxlen))
|
|
|
|
|
|
|
|
for address in ('jan@dittberner.info', 'jan', 'jan@gnuelf#test.de',
|
|
|
|
'd.arnstadt@gmx.net'):
|
|
|
|
if gnuviech.tools.checkEmail(address):
|
|
|
|
self.logger.debug("%s is a valid email address." % address)
|
|
|
|
else:
|
|
|
|
self.logger.debug("%s is an invalid email address." % address)
|
2004-12-26 20:29:32 +01:00
|
|
|
|
|
|
|
domain = GNVDomain("dittberner.info", self.prefs)
|
|
|
|
self.logger.debug("Domain %s." % domain)
|
|
|
|
domain = GNVDomain("jesusgemeindesohland.de", self.prefs)
|
|
|
|
self.logger.debug("Domain %s." % domain)
|
2004-12-26 00:09:19 +01:00
|
|
|
|
2004-12-26 16:50:53 +01:00
|
|
|
if __name__ == "__main__":
|
|
|
|
prefs = gnuviech.GNVPrefs()
|
|
|
|
Test(prefs).doTest()
|