def register_bare(self, **fields): """ Registers a user as specified by username (or email) and a raw password. """ settings = self._get_login_settings() # users can register_bare even if no password is provided, # in this case they will have to reset their password to login if fields.get(settings.passfield): fields[settings.passfield] = \ settings.table_user[settings.passfield].validate(fields[settings.passfield])[0] if not fields.get(settings.userfield): raise ValueError('register_bare: ' + 'userfield not provided or invalid') user = self.get_or_create_user(fields, login=False, get=False, update_fields=self.settings.update_fields) if not user: # get or create did not create a user (it ignores duplicate records) return False return user
user = self.get_or_create_user(fields, login=False, get=False, update_fields=self.settings.update_fields)
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
What do you mean? You can test that it returns a correct user when you register_bare, then you can test that it returns False if you try to register that same user again, finally you can try to register a user with some value that doesn't validate and assert that it raises a ValueError
--
I don't get it, what do you mean a "real registration"? Of course it is, it's inserted in the auth_user database, what more is there left for a registration to be real?
Those tests seem fine to me if you add a truncate in the end and maybe a test with an invalid email or something also throwing a ValueError.
--