Ejemplo n.º 1
0
 def test_004_update_user(self, payload):
     '''更新用户'''
     User.user_name = 'Update{}'.format(User.user_name)
     User.phone = '1{}'.format(Common.format_time()[4:])
     User.role_ids = Common.random_list(User.role_ids)
     payload['path'] = payload['path'].format(User.user_id)
     payload['params']['userName'] = User.user_name
     payload['params']['roleIds'] = User.role_ids
     payload['params']['phone'] = User.phone
     Common.check(self, payload)
     self.test_003_get_user_details_test_001_get_user_details()
Ejemplo n.º 2
0
 def random_roles(self):
     '''获取随机个数的随机角色信息'''
     roles = Common.random_list(Setting.roles_permissions)
     role_ids = [role.get('role_id') for role in roles]
     role_permissions = []
     for role in roles:
         role_permissions += role.get('role_permission')
     print(role_ids)
     print(role_permissions)
     print(set(role_permissions))
     return role_ids, list(set(role_permissions))
Ejemplo n.º 3
0
 def test_002_add_user(self, payload):
     '''创建用户'''
     User.user_name = 'AutoTest{}'.format(Common.format_time())
     User.phone = '1{}'.format(Common.format_time()[4:])
     User.role_ids = Common.random_list(User.role_ids)
     payload['params']['userName'] = User.user_name
     payload['params']['roleIds'] = User.role_ids
     payload['params']['phone'] = User.phone
     res = Common.check(self, payload)
     User.user_id = res.json().get('data').get('id')
     User.user_status = 1