def isValidName(name): """ Validate user name :param name: user name, unicode """ normalized = normalizeName(name) return (name == normalized) and not wikiutil.isGroupItem(name)
def testNormalizeGroupName(self): """ request: normalize itemname: restrict groups to alpha numeric Unicode Spaces should normalize after invalid chars removed! """ cases = ( # current acl chars (u'Name,:Group', u'NameGroup'), # remove than normalize spaces (u'Name ! @ # $ % ^ & * ( ) + Group', u'Name Group'), ) for test, expected in cases: # validate we are testing valid group names if wikiutil.isGroupItem(test): result = wikiutil.normalize_pagename(test, app.cfg) assert result == expected