Пример #1
0
 def setUp(self):
     super(TestListUsers, self).setUp()
     user_api.add_user(
         self.user_object,
         email='*****@*****.**',
         password='******'
     )
Пример #2
0
def _setup_user_table(user_session):
    """Initialize user table with default user."""
    logging.info('setup user table')
    from compass.db.api import user
    user.add_user(
        session=user_session,
        email=setting.COMPASS_ADMIN_EMAIL,
        password=setting.COMPASS_ADMIN_PASSWORD,
        is_admin=True
    )
Пример #3
0
 def test_not_admin(self):
     user_api.add_user(user=self.user_object,
                       email='*****@*****.**',
                       password='******',
                       is_admin=False)
     user_object = user_api.get_user_object('*****@*****.**')
     self.assertRaises(exception.Forbidden,
                       user_api.update_user,
                       2,
                       user=user_object,
                       is_admin=False)
Пример #4
0
 def test_not_admin(self):
     user_api.add_user(
         user=self.user_object,
         email='*****@*****.**',
         password='******',
         is_admin=False
     )
     user_object = user_api.get_user_object('*****@*****.**')
     self.assertRaises(
         exception.Forbidden,
         user_api.update_user,
         2,
         user=user_object,
         is_admin=False
     )
Пример #5
0
 def test_add_user(self):
     user_objs = user_api.add_user(
         self.user_object,
         email='*****@*****.**',
         password='******'
     )
     self.assertEqual('*****@*****.**', user_objs['email'])
Пример #6
0
def add_user():
    """add user."""
    data = _get_request_data()
    user_dict = user_api.add_user(current_user, **data)
    return utils.make_json_response(
        200, user_dict
    )
Пример #7
0
 def test_add_user_session(self):
     with database.session() as session:
         user_objs = user_api.add_user(email='*****@*****.**',
                                       password='******',
                                       user=self.user_object,
                                       session=session)
     self.assertEqual('*****@*****.**', user_objs['email'])
Пример #8
0
 def test_add_user(self):
     user_objs = user_api.add_user(
         email='*****@*****.**',
         password='******',
         user=self.user_object,
     )
     self.assertEqual('*****@*****.**', user_objs['email'])
Пример #9
0
 def test_add_user_session(self):
     with database.session() as session:
         user_objs = user_api.add_user(
             email='*****@*****.**',
             password='******',
             user=self.user_object,
             session=session
         )
     self.assertEqual('*****@*****.**', user_objs['email'])
Пример #10
0
 def setUp(self):
     super(TestListUsers, self).setUp()
     user_api.add_user(user=self.user_object,
                       email='*****@*****.**',
                       password='******')