def test_del_supervisor_room_id_error(self):
        """
        测试请求取消管理接口房间ID不存在,可以成功
        :return:
        """
        add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
        add_supervisor_ajax.get({
            'room_id': self.room_id,
            'anchor_id': self.anchor_id,
            'user_id': self.user_id,
            'type': '60'
        })
        self.assertEqual(add_supervisor_ajax.get_resp_code(), 0)

        super_visor_details = MysqlOperation(
            user_id=self.user_id).get_anchor_room_supervisor_details()
        self.assertEqual(super_visor_details['is_advance_admin'], 1)

        del_supervisor_ajax = DelSupervisorAjax(self.anchor_mobile)
        del_supervisor_ajax.get({
            'room_id': '909090',
            'anchor_id': self.anchor_id,
            'user_id': self.user_id
        })
        self.assertEqual(del_supervisor_ajax.get_resp_code(), 0)
    def test_del_supervisor_60_success(self):
        """
        测试主播取消高管成功
        :return:
        """
        add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
        add_supervisor_ajax.get({
            'room_id': self.room_id,
            'anchor_id': self.anchor_id,
            'user_id': self.user_id,
            'type': '60'
        })
        self.assertEqual(add_supervisor_ajax.get_resp_code(), 0)

        super_visor_details = MysqlOperation(
            user_id=self.user_id).get_anchor_room_supervisor_details()
        self.assertEqual(super_visor_details['is_advance_admin'], 1)

        del_supervisor_ajax = DelSupervisorAjax(self.anchor_mobile)
        del_supervisor_ajax.get({
            'room_id': self.room_id,
            'anchor_id': self.anchor_id,
            'user_id': self.user_id
        })
        self.assertEqual(del_supervisor_ajax.get_resp_code(), 0)

        super_visor_details = MysqlOperation(
            user_id=self.user_id).get_anchor_room_supervisor_details()
        self.assertIsNone(super_visor_details)
Ejemplo n.º 3
0
    def test_user_to_normal_admin_forbid_visit(self):
        """
        测试普通用户无法对普管禁止访问
        :return:
        """
        add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
        add_supervisor_ajax.get({
            'room_id': self.room_id,
            'anchor_id': self.anchor_id,
            'user_id': self.admin_user_id,
            'type': '40'
        })
        self.assertEqual(add_supervisor_ajax.get_resp_code(), 0)

        super_visor_details = MysqlOperation(
            user_id=self.admin_user_id).get_anchor_room_supervisor_details()
        self.assertEqual(super_visor_details['is_normal_admin'], 1)

        add_black_user_ajax = AddBlackUserAjax(self.user_mobile)
        add_black_user_ajax.get({
            'room_id': self.room_id,
            'anchor_id': self.anchor_id,
            'user_id': self.admin_user_id,
            'blacker_type': 'forbid_visit'
        })
        self.assertEqual(add_black_user_ajax.get_resp_code(), 801018)
        self.assertEqual(add_black_user_ajax.get_resp_message(), '权限不够')
 def test_add_supervisor_room_id_error(self):
     """
     测试请求添加管理接口房间ID不存在,可以成功
     :return:
     """
     add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
     add_supervisor_ajax.get({
         'room_id': '909090',
         'anchor_id': self.anchor_id,
         'user_id': self.user_id,
         'type': '40'
     })
     self.assertEqual(add_supervisor_ajax.get_resp_code(), 0)
    def test_add_supervisor_40_success(self):
        """
        测试主播设置普通管理成功
        :return:
        """
        add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
        add_supervisor_ajax.get({
            'room_id': self.room_id,
            'anchor_id': self.anchor_id,
            'user_id': self.user_id,
            'type': '40'
        })
        self.assertEqual(add_supervisor_ajax.get_resp_code(), 0)

        super_visor_details = MysqlOperation(
            user_id=self.user_id).get_anchor_room_supervisor_details()
        self.assertEqual(super_visor_details['is_normal_admin'], 1)
 def test_add_supervisor_type_error(self):
     """
     测试请求添加管理接口类型不存在
     :return:
     """
     add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
     add_supervisor_ajax.get({
         'room_id': self.room_id,
         'anchor_id': self.anchor_id,
         'user_id': self.user_id,
         'type': '87'
     })
     self.assertEqual(add_supervisor_ajax.get_resp_code(), 900003)
     self.assertEqual(add_supervisor_ajax.get_resp_message(), '管理员类型异常')
 def test_add_supervisor_type_null(self):
     """
     测试请求添加管理接口类型为空
     :return:
     """
     add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
     add_supervisor_ajax.get({
         'room_id': self.room_id,
         'anchor_id': self.anchor_id,
         'user_id': self.user_id,
         'type': None
     })
     self.assertEqual(add_supervisor_ajax.get_resp_code(), 411127)
     self.assertEqual(add_supervisor_ajax.get_resp_message(), '管理员类型不能为空')
 def test_add_supervisor_user_id_error(self):
     """
     测试请求添加管理接口用户ID不存在
     :return:
     """
     add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
     add_supervisor_ajax.get({
         'room_id': self.room_id,
         'anchor_id': self.anchor_id,
         'user_id': '90909090',
         'type': '40'
     })
     self.assertEqual(add_supervisor_ajax.get_resp_code(), 801027)
     self.assertEqual(add_supervisor_ajax.get_resp_message(), '用户信息不存在')
 def test_add_supervisor_user_id_null(self):
     """
     测试请求添加管理接口用户ID为空
     :return:
     """
     add_supervisor_ajax = AddSupervisorAjax(self.anchor_mobile)
     add_supervisor_ajax.get({
         'room_id': self.room_id,
         'anchor_id': self.anchor_id,
         'user_id': None,
         'type': '40'
     })
     self.assertEqual(add_supervisor_ajax.get_resp_code(), 801020)
     self.assertEqual(add_supervisor_ajax.get_resp_message(), '用户id不能为空')