diff --git a/gluon/tests/test_tools.py b/gluon/tests/test_tools.py index d30c7003..8befce19 100644 --- a/gluon/tests/test_tools.py +++ b/gluon/tests/test_tools.py @@ -493,9 +493,7 @@ class TestAuth(unittest.TestCase): self.assertTrue('auth_permission' in self.db) self.assertTrue('auth_event' in self.db) - def test_enable_record_versioning(self): - self.assertTrue('t0_archive' in self.db) - + # Just calling many form functions def test_basic_blank_forms(self): for f in ['login', 'retrieve_password', 'retrieve_username', 'register']: html_form = getattr(self.auth, f)().xml() @@ -516,6 +514,20 @@ class TestAuth(unittest.TestCase): pass return + def test_get_vars_next(self): + self.current.request.vars._next = 'next_test' + self.assertEqual(self.auth.get_vars_next(), 'next_test') + + # TODO: def test_navbar(self): + # TODO: def test___get_migrate(self): + + def test_enable_record_versioning(self): + self.assertTrue('t0_archive' in self.db) + + # TODO: def test_define_signature(self): + # TODO: def test_define_signature(self): + # TODO: def test_define_table(self): + def test_log_event(self): self.auth.login_user(self.db(self.db.auth_user.username == 'bart').select().first()) # bypass login_bare() bart_id = self.db(self.db.auth_user.username == 'bart').select(self.db.auth_user.id).first().id @@ -581,6 +593,10 @@ class TestAuth(unittest.TestCase): self.db.auth_user.truncate() self.db.commit() + # TODO: def test_basic(self): + # TODO: def test_login_user(self): + # TODO: def test__get_login_settings(self): + # login_bare() seems broken see my post on web2py-developpers # commented for now # def test_login_bare(self): @@ -592,12 +608,6 @@ class TestAuth(unittest.TestCase): # self.auth.logout_bare() # self.db.auth_user.truncate() - def test_logout_bare(self): - self.auth.login_user(self.db(self.db.auth_user.username == 'bart').select().first()) # bypass login_bare() - self.assertTrue(self.auth.is_logged_in()) - self.auth.logout_bare() - self.assertFalse(self.auth.is_logged_in()) - def test_register_bare(self): # corner case empty register call register_bare without args self.assertRaises(ValueError, self.auth.register_bare) @@ -616,12 +626,50 @@ class TestAuth(unittest.TestCase): self.db.auth_user.truncate() self.db.commit() + # TODO: def test_cas_login(self): + # TODO: def test_cas_validate(self): + # TODO: def test__reset_two_factor_auth(self): + # TODO: def test_when_is_logged_in_bypass_next_in_url(self): + # TODO: def test_login(self): + # TODO: def test_logout(self): + + def test_logout_bare(self): + self.auth.login_user(self.db(self.db.auth_user.username == 'bart').select().first()) # bypass login_bare() + self.assertTrue(self.auth.is_logged_in()) + self.auth.logout_bare() + self.assertFalse(self.auth.is_logged_in()) + + # TODO: def test_register(self): + + def test_is_logged_in(self): + self.auth.user = 'logged_in' + self.assertTrue(self.auth.is_logged_in()) + self.auth.user = None + self.assertFalse(self.auth.is_logged_in()) + + # TODO: def test_verify_email(self): + # TODO: def test_retrieve_username(self): + + def test_random_password(self): + # let just check that the function is callable + self.assertTrue(self.auth.random_password()) + + # TODO: def test_reset_password_deprecated(self): + # TODO: def test_confirm_registration(self): + # TODO: def test_email_registration(self): + def test_bulk_register(self): self.auth.login_user(self.db(self.db.auth_user.username == 'bart').select().first()) # bypass login_bare() self.auth.settings.bulk_register_enabled = True bulk_register_form = self.auth.bulk_register(max_emails=10).xml() self.assertTrue('name="_formkey"' in bulk_register_form) + # TODO: def test_manage_tokens(self): + # TODO: def test_reset_password(self): + # TODO: def test_request_reset_password(self): + # TODO: def test_email_reset_password(self): + # TODO: def test_retrieve_password(self): + def test_change_password(self): self.auth.login_user(self.db(self.db.auth_user.username == 'bart').select().first()) # bypass login_bare() change_password_form = getattr(self.auth, 'change_password')().xml() @@ -632,9 +680,9 @@ class TestAuth(unittest.TestCase): profile_form = getattr(self.auth, 'profile')().xml() self.assertTrue('name="_formkey"' in profile_form) - def test_get_vars_next(self): - self.current.request.vars._next = 'next_test' - self.assertEqual(self.auth.get_vars_next(), 'next_test') + # TODO: def test_run_login_onaccept(self): + # TODO: def test_jwt(self): + # TODO: def test_is_impersonating(self): def test_impersonate(self): # Create a user to be impersonated @@ -697,7 +745,9 @@ class TestAuth(unittest.TestCase): self.assertTrue(self.auth.is_impersonating()) self.assertEqual(self.auth.impersonate(user_id=0), None) - def test_group(self): + # TODO: def test_update_groups(self): + + def test_groups(self): self.auth.login_user(self.db(self.db.auth_user.username == 'bart').select().first()) # bypass login_bare() self.assertEqual(self.auth.groups().xml(), '
user_1(1) |