예제 #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='******')