def generate_password(self): """Generate password, set :py:attr:`password` and return clear value. Uses ``settings.TICKETOFFICE_PASSWORD_GENERATOR``. Does not save the instance. """ import_path, args, kwargs = settings.TICKETOFFICE_PASSWORD_GENERATOR generator = import_member(import_path) clear_password = generator(*args, **kwargs) self.set_password(clear_password) return clear_password
def test_password_generator_default(self): "django_ticketoffice.settings.TICKETOFFICE_PASSWORD_GENERATOR works." import_path, args, kwargs = TICKETOFFICE_PASSWORD_GENERATOR generator = utils.import_member(import_path) password = generator(args, kwargs) self.assertTrue(password)