def test_wrong_login_log(self):
     # 登录管理员账号
     response = login(
         get_header(''),
         json_dump(wrong_login_log_data.administrator_login_data))
     # 新增人员
     add_user_information(get_header(response.json()['d']['authorization']),
                          json_dump(wrong_login_log_data.add_user_data))
     # 错误登录
     login(get_header(''),
           json_dump(wrong_login_log_data.user_wrong_password_login_data))
     login(get_header(''),
           json_dump(wrong_login_log_data.user_wrong_password_login_data))
Beispiel #2
0
 def test_wrong_five_time_lock_account(self):
     for i in range(5):
         login(
             get_header(''),
             json_dump(
                 wrong_five_time_wrong_password_lock_account_login_data.
                 user_five_time_wrong_password_lock_account_login_data))
     response = login(
         get_header(''),
         json_dump(wrong_five_time_wrong_password_lock_account_login_data.
                   user_five_time_wrong_password_lock_account_login_data))
     self.assertEqual(200, response.status_code)
     self.assertEqual(False, response.json()['s'])
     self.assertEqual('您已5次输入密码错误,账户被锁定,请5分钟后再进行登录操作', response.json()['m'])
     case_name = '支持密码输入错误5次后,锁定账户5分钟'
     if response.status_code == 200:
         log().info('%s 的接口is pass' % case_name)
     else:
         log().error('%s 的接口is fail' % case_name, response.json())
Beispiel #3
0
 def test_after_lock_new_account_normal_login(self):
     for i in range(5):
         login(
             get_header(''),
             json_dump(
                 after_lock_new_account_normal_login.
                 user_five_time_wrong_password_lock_account_login_data))
     response = login(
         get_header(''),
         json_dump(after_lock_new_account_normal_login.new_account_data))
     self.assertEqual(200, response.status_code)
     self.assertEqual(True, response.json()['s'])
     self.assertEqual('登录成功', response.json()['m'])
     self.assertEqual('admin', response.json()['d']['user']['username'])
     self.assertEqual('管理员', response.json()['d']['user']['userrole'])
     case_name = '登录账号时,正常输入账号,密码,验证码,正常登录'
     if response.status_code == 200:
         log().info('%s 的接口is pass' % case_name)
     else:
         log().error('%s 的接口 is fail' % case_name, response.json())
Beispiel #4
0
 def test_not_password_login(self):
     response = login(
         get_header(''),
         json_dump(not_password_login_data.user_not_password_login_data))
     self.assertEqual(200, response.status_code)
     self.assertEqual(False, response.json()['s'])
     self.assertEqual('密码不能为空', response.json()['m'])
     case_name = '登录账号时,密码没填,正常输入账号,验证码,登录报错'
     if response.status_code == 200:
         log().info('%s 的接口is pass' % case_name)
     else:
         log().error('%s 的接口is fail' % case_name, response.json())
Beispiel #5
0
 def test_wrong_password_login(self):
     response = login(
         get_header(''),
         json_dump(
             wrong_password_login_data.user_wrong_password_login_data))
     self.assertEqual(200, response.status_code)
     self.assertEqual(False, response.json()['s'])
     self.assertEqual('密码错误', response.json()['m'])
     case_name = '登录账号时,输入密码错误,报错'
     if response.status_code == 200:
         log().info('%s 的接口is pass' % case_name)
     else:
         log().error('%s 的接口is fail' % case_name, response.json())
Beispiel #6
0
 def test_not_exist_account(self):
     response = login(
         get_header(''),
         json_dump(not_exist_account_login_data.
                   user_not_exist_account_login_data))
     self.assertEqual(200, response.status_code)
     self.assertEqual(False, response.json()['s'])
     self.assertEqual('登录信息有误,请确认后重新登录', response.json()['m'])
     case_name = '登录账号时,输入账号不存在,报错'
     if response.status_code == 200:
         log().info('%s 的接口is pass' % case_name)
     else:
         log().error('%s 的接口is fail' % case_name, response.json())
Beispiel #7
0
 def test_normal_login(self):
     response = login(get_header(''),
                      json_dump(normal_login_data.user_normal_login_data))
     self.assertEqual(200, response.status_code)
     self.assertEqual(True, response.json()['s'])
     self.assertEqual('登录成功', response.json()['m'])
     self.assertEqual(normal_login_data.add_user_data.get('username'),
                      response.json()['d']['user']['username'])
     self.assertEqual(normal_login_data.add_user_data.get('userrole'),
                      response.json()['d']['user']['userrole'])
     case_name = '登录账号时,正常输入账号,密码,验证码,正常登录'
     if response.status_code == 200:
         log().info('%s 的接口is pass' % case_name)
     else:
         log().error('%s 的接口 is fail' % case_name, response.json())
Beispiel #8
0
 def setUpClass(cls):
     warnings.simplefilter("ignore",
                           ResourceWarning)  # 去除requests中多余的warning
     delete_database_data_test_ci()  # 清空数据库
     add_database_data_test_ci()  # 新增配置数据
     # 登录管理员账号
     response = login(get_header(''),
                      json_dump(login_basic_data.administrator_login_data))
     # 新增人员
     add_user_information(get_header(response.json()['d']['authorization']),
                          json_dump(login_basic_data.add_user_data_one))
     add_user_information(get_header(response.json()['d']['authorization']),
                          json_dump(login_basic_data.add_user_data_two))
     add_user_information(get_header(response.json()['d']['authorization']),
                          json_dump(login_basic_data.add_user_data_three))
     add_user_information(get_header(response.json()['d']['authorization']),
                          json_dump(login_basic_data.add_user_data_four))
Beispiel #9
0
    def setUpClass(cls):
        warnings.simplefilter("ignore", ResourceWarning)  # 去除requests中多余的warning
        delete_database_data_test_ci()  # 清空数据库
        add_database_data_test_ci()  # 新增配置数据
        # 登录管理员账号
        response = login(get_header(''), json_dump(basic_data.administrator_login_data))
        # exit_login(get_header(response.json()['d']['authorization']), '')

        # 新增人员
        add_user_information(get_header(response.json()['d']['authorization']),
                                   json_dump(basic_data.add_user_data_one))
        add_user_information(get_header(response.json()['d']['authorization']),
                             json_dump(basic_data.add_user_data_two))
        add_user_information(get_header(response.json()['d']['authorization']),
                             json_dump(basic_data.add_user_data_three))
        add_user_information(get_header(response.json()['d']['authorization']),
                             json_dump(basic_data.add_user_data_four))

        # 新增设备
        add_device_information(get_header(response.json()['d']['authorization']), json_dump(basic_data.device_data))

        # 登录
        cls.user_id_one = login(get_header(''), json_dump(basic_data.login_user_data_one)).json()['d']['user']['id']
        login(get_header(''), json_dump(basic_data.login_user_data_two))
        cls.user_id_two = login(get_header(''), json_dump(basic_data.login_user_data_two)).json()['d']['user']['id']
        cls.user_id_three = login(get_header(''), json_dump(basic_data.login_user_data_three)).json()['d']['user']['id']
        cls.user_id_four = login(get_header(''), json_dump(basic_data.login_user_data_four)).json()['d']['user']['id']

        # 获取设备id
        device_id = get_data_from_database('select id from spzh_device where name = "设备一"')[0][0]
        user_bind_device_data = {
            "id": cls.user_id_one,
            "ids": device_id,
            "morendevice": device_id,

        }
        user_bind_device(get_header(response.json()['d']['authorization']), json_dump(user_bind_device_data))

        # 视频会议人员连接socket
        cls.ws_one = connect_socket(cls.user_id_one)
        cls.ws_two = connect_socket(cls.user_id_two)
        cls.ws_three = connect_socket(cls.user_id_three)
        cls.ws_four = connect_socket(cls.user_id_four)

        # 主席身份登录
        cls.auth = login(get_header(''), json_dump(basic_data.login_user_data_one)).json()['d']['authorization']
        add_video_conference_data = {
            'name': '视频会议',
            'chairMan': cls.user_id_one,
            'spokesMan': cls.user_id_one,
            'member': [
                {'id': cls.user_id_one,
                 'type': 2
                 },
                {
                    'id': cls.user_id_two,
                    'type': 2
                },
                {
                    'id': cls.user_id_three,
                    'type': 2
                }
            ],
        }

        # 新增视频会议组
        add_video_conference_group(get_header(cls.auth), json_dump(add_video_conference_data))

        # 获取视频会议组
        cls.meeting_conference_id = receive_video_meeting_group_list(get_header(cls.auth), '').json()['d']['list'][0]['id']

        # 启动视频会议组
        open_meeting_data = {
            'chairMan': cls.user_id_one,
            'id': cls.meeting_conference_id
        }
        video_meeting_open_meeting(get_header(cls.auth), json_dump(open_meeting_data))