def test_user_page(self): # Username 'tester' does not exist self.get('/u/james', expected_status=404) # Username will be 'harry' with self.app.test_request_context(): force_cli_user() create_local_user('*****@*****.**', 'password') self.get('/u/james')
def test_user_page(self): from pillar.api.utils.authentication import force_cli_user from pillar.api.local_auth import create_local_user # Username 'tester' does not exist self.get('/u/harry', expected_status=404) # Username will be 'harry' with self.app.test_request_context(): force_cli_user() create_local_user('*****@*****.**', 'password') self.get('/u/harry')
def setUp(self, **kwargs): super().setUp(**kwargs) self.ensure_group_exists( 'cafef005972666988bef650f', 'dillo_user_main') self.proj_id, self.project = self.ensure_project_exists() with self.app.test_request_context(): force_cli_user() self.local_user_id = create_local_user('*****@*****.**', 'password')
def test_create_user(self): from pillar.api.utils.authentication import force_cli_user from pillar.api.local_auth import create_local_user with self.app.test_request_context(): force_cli_user() user_id = create_local_user('*****@*****.**', 'password') db_user = self.fetch_user_from_db(user_id) print(db_user)
def create_test_user(self): from pillar.api import local_auth with self.app.test_request_context(): user_id = local_auth.create_local_user('*****@*****.**', 'oti') return user_id
def create_local_user_account(email, password): from pillar.api.local_auth import create_local_user create_local_user(email, password)