示例#1
0
 def get(self):
     res = ResMsg()
     try:
         data = config_env.get_env()
         res.update(data=data)
     except Exception as e:
         res.update(code=ResponseCode.FAIL, msg=str(e))
     res = jsonify(res.data)
     return res
示例#2
0
class ConfigCase:
    ENV = get_env()
    PROTOCOL = "https" if ENV == 'prod' else "http"
    HOST_STUDY = "study.ewt360.com" if ENV == 'prod' else "study.{}.mistong.com".format(
        ENV)
    HOST_TIKU = "gateway.ewt360.com" if ENV == 'prod' else "gateway.{}.mistong.com".format(
        ENV)
    HOST_TEACHER = "teacher.ewt360.com" if ENV == 'prod' else "teacher.{}.mistong.com".format(
        ENV)
    HOST_WX = "wx.ewt360.com" if ENV == 'prod' else "wx.test.mistong.com"
    HOST_GATEWAY = "gateway.ewt360.com" if ENV == 'prod' else "gateway.test.mistong.com"
    HOST_WEB = "web.ewt360.com" if ENV == 'prod' else "web.test.mistong.com"
    HOST_INSIDEGATEWAY = "insidegateway.ewt360.com" if ENV == 'prod' else "insidegateway.test.mistong.com"
    HOST_ADMIN = "admin.mistong.com" if ENV == 'prod' else "admin.test.mistong.com"
    HOST_PASSPORT = "passport.ewt360.com" if ENV == 'prod' else "my.{}.mistong.com".format(
        ENV)
    HOST_QBANK = "admin.mistong.com" if ENV == 'prod' else "admin.{}.mistong.com".format(
        ENV)

    QQopenId = "B7A0621A87508E323DD098F279499336" if ENV == 'prod' else "72F8A3C4625EE2171814CF078000D883"
示例#3
0
from config.config_env import get_env

sleeptime = 20 if get_env() != 'prod' else 30
basketaddinputs1 = [{
    "Qid": 343,
    "KeMu": 1,
    "KnowledgeId": -1
}] if get_env() != 'prod' else [{
    "Qid": 2096,
    "KeMu": "1",
    "KnowledgeId": -1
}]
basketaddinputs2 = [{"Qid": 343, "KeMu": 1, "KnowledgeId": -1}, {"Qid": 342, "KeMu": 1, "KnowledgeId": -1},
                    {"Qid": 99, "KeMu": 1, "KnowledgeId": -1}] \
    if get_env() != 'prod' else [{"Qid": 2096, "KeMu": "1", "KnowledgeId": -1}, {"Qid": 2094, "KeMu": "1", "KnowledgeId": -1}]

knowLedgeIds = [
    7682, 7683, 6678, 6727, 6775, 6871, 6902, 6851, 6852, 6793, 6853, 6856,
    6857, 6858, 6859, 6860, 6861, 6862, 6863, 6865, 6866, 6947, 6948, 6949,
    6950, 6876, 6877, 6878, 6879, 6951, 6943, 6944, 6945, 6946, 7027, 7028
]
示例#4
0
from common.unittest_v2 import TestCaseV2
from lib.api_lib.tiku.tiku_api import Tiku as tiku
from lib.api_lib.ewt_client import WebClient
from testcases.api_testcases.tiku_testcases.tiku_data import *
import unittest
from config.config_env import get_env


@unittest.skipIf(get_env() != 'prod', "线下case还未跑通")
class SubjectTest(TestCaseV2):
    @classmethod
    def setUpClass(cls):
        pass
        # cls.tiku_web = tiku(WebClient(username=user_vip['username'], password=user_vip['password']))
    @classmethod
    def tearDownClass(cls):
        pass

    def test_post_unioncheck(self):
        """
        title: 聚合接口-查询题目信息(自建题库、菁优题库和老数据)
        url: /api/qbank/uniform/question/info
        author: 廖文龙
        """
        tiku_web = tiku(WebClient(username=user_vip['username'], password=user_vip['password']))
        res = tiku_web.post_Unioncheck(questionIdList=questionIdList)
        print(res)
        self.assertEqual('200', res['code'])
        self.assertEqual('操作成功', res['msg'])
        self.assertIn('questionId', res['data'][0])
        self.assertIn('optionsList', res['data'][0])
示例#5
0
menu_menuId = 25
menu_subjectId = 2
assign_subjectId = 2
solutionid1 = 33
solutionid2 = 141  # 直连
Id = 162
paperId = 856
timestring = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
paper_title = "试卷" + timestring
paper_refIds = [787]
video_title = "2个视频" + timestring
video_refIds = [2419, 1]
topic_title = "专题" + timestring
topic_refIds = [172]
if get_env() == 'prod':
    menu_menuId = 3
    menu_subjectId = 1
    assign_subjectId = 1
    solutionid1 = 11
    # solutionid2 = 141 直连
    Id = 285
    paperId = 43228
    paper_title = "试卷" + timestring
    paper_refIds = [43228]
    video_title = "2个视频" + timestring
    video_refIds = [19463, 19464]
    topic_title = "专题" + timestring
    topic_refIds = [264]

promotion_themeid = 4 if get_env() == 'prod' else 70
示例#6
0
class SbrLive(TestCaseV2):

    @classmethod
    def setUpClass(cls):
        pass

    @classmethod
    def tearDownClass(cls):
        pass

    def test_p1_1_sbrlive_listTeacherLiveRecord(self):
        """
        title: 查询教师端直播的回放列表
        url: /api/netschool/sbrlive/listTeacherLiveRecord
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_listTeacherLiveRecord(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        for i in range(0, len(res['data'])):
            self.assertEqual(str(liveId), res['data'][i]['liveId'])
            self.assertIn("片段%s" % (i + 1), res['data'][i]['recordName'])
            self.assertIsNotNone(res['data'][i]['beginTime'])
            self.assertIsNotNone(res['data'][i]['endTime'])
            self.assertIsNotNone(res['data'][i]['ccLiveId'])
            self.assertIsNotNone(res['data'][i]['ccRecordId'])
            self.assertTrue(res['data'][i]['duration'] > 10)

    def get_liveId(self, teacher_web, status):
        res = teacher_web.sbrlive_pageQueryMyLive(liveStatus=status, pageIndex=1, pageSize=100)
        print(res)
        liveIds = [i['id'] for i in res['data']]
        sorted(liveIds)
        print(liveIds)
        return liveIds[-1]

    def test_p1_1_sbrlive_create(self):
        """
        title: 校长给单个班级创建直播, 编辑直播, 删除直播
        url: /api/netschool/sbrlive/create,/api/netschool/sbrlive/edit,/api/netschool/sbrlive/delete
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        startTime = CaseServices.get_deadlinetime()
        finishTime = CaseServices.get_deadlinetime() + 3000000
        res = teacher_web.sbrlive_create(liveName="直播自动化测试", roomStyle=1, startTime=startTime, finishTime=finishTime,
                                         schoolId=schoolid,
                                         classType=1, numberOfStudent=12, gradeClassList=[
                {"graduationYear": expireyear, "isAll": 0, "classIdList": [str(groupid_xingzheng)]}])
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['data'])
        liveId = self.get_liveId(teacher_web, status=0)
        res2 = teacher_web.sbrlive_edit(id=liveId, liveName="直播自动化测试_编辑", roomStyle=1, startTime=startTime + 1000000,
                                        finishTime=finishTime, schoolId=schoolid,
                                        classType=1, numberOfStudent=12, gradeClassList=[
                {"graduationYear": expireyear, "isAll": 0, "classIdList": [str(groupid_xingzheng)]}])
        print(res2)
        self.assertEqual("200", res2['code'])
        self.assertTrue(res2['data'])
        res3 = teacher_web.sbrlive_delete(liveId=liveId)
        print(res3)
        self.assertEqual("200", res3['code'])
        self.assertTrue(res['data'])

    def test_p1_2_sbrlive_create(self):
        """
        title: 年级主任给年级创建直播, 编辑直播, 删除直播
        url: /api/netschool/sbrlive/create,/api/netschool/sbrlive/edit,/api/netschool/sbrlive/delete
        author: 章志君
        """
        teacher_web = teacher(web_client(username=grademaster_user['username']))
        startTime = CaseServices.get_deadlinetime()
        finishTime = CaseServices.get_deadlinetime() + 3000000
        res = teacher_web.sbrlive_create(liveName="直播自动化测试", roomStyle=1, startTime=startTime, finishTime=finishTime,
                                         schoolId=schoolid,
                                         classType=1, numberOfStudent=12,
                                         gradeClassList=[{"graduationYear": expireyear, "isAll": 1, "classIdList": []}])
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['data'])
        time.sleep(10)
        liveId = self.get_liveId(teacher_web, status=0)
        res3 = teacher_web.sbrlive_delete(liveId=liveId)
        print(res3)
        self.assertEqual("200", res3['code'])
        self.assertTrue(res['data'])

    def test_p1_3_sbrlive_create(self):
        """
        title: 教学班主任给单个教学班班级创建直播,  删除直播
        url: /api/netschool/sbrlive/create,/api/netschool/sbrlive/edit,/api/netschool/sbrlive/delete
        author: 章志君
        """
        teacher_web = teacher(web_client(username=classheadteacher_user['username']))
        startTime = CaseServices.get_deadlinetime()
        finishTime = CaseServices.get_deadlinetime() + 3000000
        res = teacher_web.sbrlive_create(liveName="直播自动化测试", roomStyle=1, startTime=startTime, finishTime=finishTime,
                                         schoolId=schoolid,
                                         classType=2, numberOfStudent=12, gradeClassList=[
                {"graduationYear": expireyear, "isAll": 0, "classIdList": [str(groupid_jiaoxue)]}])
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['data'])
        time.sleep(10)
        liveId = self.get_liveId(teacher_web, status=0)
        res3 = teacher_web.sbrlive_delete(liveId=liveId)
        print(res3)
        self.assertEqual("200", res3['code'])
        self.assertTrue(res['data'])

    def test_p1_4_sbrlive_create(self):
        """
        title: 行政班主任给单个教学班班级创建直播,  删除直播
        url: /api/netschool/sbrlive/create,/api/netschool/sbrlive/edit,/api/netschool/sbrlive/delete
        author: 章志君
        """
        teacher_web = teacher(web_client(username=headteacher_user['username']))
        startTime = CaseServices.get_deadlinetime()
        finishTime = CaseServices.get_deadlinetime() + 3000000
        res = teacher_web.sbrlive_create(liveName="直播自动化测试", roomStyle=1, startTime=startTime, finishTime=finishTime,
                                         schoolId=schoolid,
                                         classType=1, numberOfStudent=12, gradeClassList=[
                {"graduationYear": expireyear, "isAll": 0, "classIdList": [str(groupid_xingzheng)]}])
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['data'])
        time.sleep(10)
        liveId = self.get_liveId(teacher_web, status=0)
        res3 = teacher_web.sbrlive_delete(liveId=liveId)
        print(res3)
        self.assertEqual("200", res3['code'])
        self.assertTrue(res['data'])

    def test_p1_5_sbrlive_create(self):
        """
        title: 心理老师给单个班级创建直播, 编辑为年级直播作业, 删除直播
        url: /api/netschool/sbrlive/create,/api/netschool/sbrlive/edit,/api/netschool/sbrlive/delete
        author: 章志君
        """
        teacher_web = teacher(web_client(username=psychologicalteacher_user['username']))
        startTime = CaseServices.get_deadlinetime()
        finishTime = CaseServices.get_deadlinetime() + 3000000
        res = teacher_web.sbrlive_create(liveName="直播自动化测试", roomStyle=1, startTime=startTime, finishTime=finishTime,
                                         schoolId=schoolid,
                                         classType=1, numberOfStudent=12, gradeClassList=[
                {"graduationYear": expireyear, "isAll": 0, "classIdList": [str(groupid_xingzheng)]}])
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['data'])
        time.sleep(10)
        liveId = self.get_liveId(teacher_web, status=0)
        res2 = teacher_web.sbrlive_edit(id=liveId, liveName="直播自动化测试_编辑", roomStyle=1, startTime=startTime + 1000000,
                                        finishTime=finishTime, schoolId=schoolid,
                                        classType=1, numberOfStudent=12,
                                        gradeClassList=[{"graduationYear": expireyear, "isAll": 1, "classIdList": []}])
        print(res2)
        self.assertEqual("501", res2['code'])
        self.assertIn("已被布置为班级作业,不能切换为年级作业", res2['msg'])
        res3 = teacher_web.sbrlive_delete(liveId=liveId)
        print(res3)
        self.assertEqual("200", res3['code'])
        self.assertTrue(res['data'])

    def test_p1_6_sbrlive_create_edit(self):
        """
        title: 混合角色老师给单个教学班班级创建直播, 编辑为年级直播作业, 删除直播
        url: /api/netschool/sbrlive/create,/api/netschool/sbrlive/edit,/api/netschool/sbrlive/delete
        author: 章志君
        """
        teacher_web = teacher(web_client(username=teacher_mix_user['username']))
        startTime = CaseServices.get_deadlinetime()
        finishTime = CaseServices.get_deadlinetime() + 3000000
        res = teacher_web.sbrlive_create(liveName="直播自动化测试", roomStyle=1, startTime=startTime, finishTime=finishTime,
                                         schoolId=schoolid,
                                         classType=1, numberOfStudent=12, gradeClassList=[
                {"graduationYear": expireyear, "isAll": 0, "classIdList": [str(groupid_xingzheng)]}])
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['data'])
        time.sleep(10)
        liveId = self.get_liveId(teacher_web, status=0)
        res2 = teacher_web.sbrlive_edit(id=liveId, liveName="直播自动化测试_编辑", roomStyle=1, startTime=startTime + 1000000,
                                        finishTime=finishTime, schoolId=schoolid,
                                        classType=1, numberOfStudent=12, gradeClassList=[
                {"graduationYear": expireyear, "isAll": 0, "classIdList": [str(groupid_xingzheng)]}])
        print(res2)
        self.assertEqual("200", res2['code'])
        self.assertTrue(res2['data'])
        res3 = teacher_web.sbrlive_delete(liveId=liveId)
        print(res3)
        self.assertEqual("200", res3['code'])
        self.assertTrue(res['data'])

    def test_p1_1_sbrlive_listTeacherClasses(self):
        """
        title: 查询教师的班级列表_校长返回新高一、高一、高二、高三所有年级班级
        url: /api/netschool/sbrlive/listTeacherClasses
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_listTeacherClasses()
        print(res)
        self.assertEqual("200", res['code'])
        graduationYears = [i['graduationYear'] for i in res['data']]
        self.assertIn(len(graduationYears), (3, 4))
        for i in res['data']:
            self.assertIsNotNone(i['gradeName'])
            self.assertTrue(i['isGradeLeader'])
            for j in i['classInfoList']:
                self.assertIsNotNone(j['className'])
                self.assertIn(j['classType'], (1, 2))
                self.assertIsNotNone(j['classId'])
                if j['classId'] == str(groupid_xingzheng):
                    self.assertIsNotNone(j['className'])
                    self.assertTrue(j['numberOfStudent'] > 5)
                    self.assertIn(j['classType'], (1, 2))

    def test_p1_2_sbrlive_listTeacherClasses(self):
        """
        title: 查询教师的班级列表_年级主任返回对应年级的所有年级班级
        url: /api/netschool/sbrlive/listTeacherClasses
        author: 章志君
        """
        teacher_web = teacher(web_client(username=grademaster_user['username']))
        res = teacher_web.sbrlive_listTeacherClasses()
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(expireyear, res['data'][0]['graduationYear'])
        for i in res['data']:
            self.assertIsNotNone(i['gradeName'])
            self.assertTrue(i['isGradeLeader'])
            for j in i['classInfoList']:
                self.assertIsNotNone(j['className'])
                self.assertIn(j['classType'], (1, 2))
                self.assertIsNotNone(j['classId'])
                if j['classId'] == str(groupid_xingzheng):
                    self.assertIsNotNone(j['className'])
                    self.assertTrue(j['numberOfStudent'] > 5)
                    self.assertIn(j['classType'], (1, 2))

    def test_p1_3_sbrlive_listTeacherClasses(self):
        """
        title: 查询教师的班级列表_班主任对应的班级
        url: /api/netschool/sbrlive/listTeacherClasses
        author: 章志君
        """
        teacher_web = teacher(web_client(username=headteacher_user['username']))
        res = teacher_web.sbrlive_listTeacherClasses()
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(expireyear, res['data'][0]['graduationYear'])
        for i in res['data']:
            self.assertIsNotNone(i['gradeName'])
            self.assertFalse(i['isGradeLeader'])
            for j in i['classInfoList']:
                self.assertEqual(1, len(i['classInfoList']))
                if j['classId'] == str(groupid_xingzheng):
                    self.assertIsNotNone(j['className'])
                    self.assertTrue(j['numberOfStudent'] > 5)
                    self.assertIn(j['classType'], (1, 2))

    def test_p1_4_sbrlive_listTeacherClasses(self):
        """
        title: 查询教师的班级列表_接班主任对应的班级
        url: /api/netschool/sbrlive/listTeacherClasses
        author: 章志君
        """
        teacher_web = teacher(web_client(username=headteacher_user['username']))
        res = teacher_web.sbrlive_listTeacherClasses()
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(expireyear, res['data'][0]['graduationYear'])
        for i in res['data']:
            self.assertIsNotNone(i['gradeName'])
            self.assertFalse(i['isGradeLeader'])
            for j in i['classInfoList']:
                self.assertEqual(str(groupid_xingzheng), j['classId'])
                self.assertIsNotNone(j['className'])
                self.assertTrue(j['numberOfStudent'] > 5)
                self.assertIn(j['classType'], (1, 2))

    def test_p1_5_sbrlive_listTeacherClasses(self):
        """
        title: 查询教师的班级列表_接教学班主任对应的班级
        url: /api/netschool/sbrlive/listTeacherClasses
        author: 章志君
        """
        teacher_web = teacher(web_client(username=classheadteacher_user['username']))
        res = teacher_web.sbrlive_listTeacherClasses()
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(expireyear, res['data'][0]['graduationYear'])
        for i in res['data']:
            self.assertIsNotNone(i['gradeName'])
            self.assertFalse(i['isGradeLeader'])
            for j in i['classInfoList']:
                self.assertEqual(str(groupid_jiaoxue), j['classId'])
                self.assertIsNotNone(j['className'])
                self.assertTrue(j['numberOfStudent'] > 5)
                self.assertIn(j['classType'], (1, 2))

    def test_p1_6_sbrlive_listTeacherClasses(self):
        """
        title: 查询教师的班级列表_任课老师对应的班级
        url: /api/netschool/sbrlive/listTeacherClasses
        author: 章志君
        """
        teacher_web = teacher(web_client(username=teacher_user['username']))
        res = teacher_web.sbrlive_listTeacherClasses()
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(expireyear, res['data'][0]['graduationYear'])
        for i in res['data']:
            self.assertIsNotNone(i['gradeName'])
            self.assertFalse(i['isGradeLeader'])
            for j in i['classInfoList']:
                self.assertEqual(str(groupid_xingzheng), j['classId'])
                self.assertIsNotNone(j['className'])
                self.assertTrue(j['numberOfStudent'] > 5)
                self.assertIn(j['classType'], (1, 2))

    def test_p1_7_sbrlive_listTeacherClasses(self):
        """
        title: 查询教师的班级列表_混合角色(校长、任课老师)返回新高一、高一、高二、高三所有年级班级
        url: /api/netschool/sbrlive/listTeacherClasses
        author: 章志君
        """
        teacher_web = teacher(web_client(username=teacher_mix_user['username']))
        res = teacher_web.sbrlive_listTeacherClasses()
        print(res)
        self.assertEqual("200", res['code'])
        graduationYears = [i['graduationYear'] for i in res['data']]
        self.assertIn(len(graduationYears), (3, 4))
        for i in res['data']:
            self.assertIsNotNone(i['gradeName'])
            self.assertTrue(i['isGradeLeader'])
            for j in i['classInfoList']:
                self.assertIsNotNone(j['className'])
                self.assertIn(j['classType'], (1, 2))
                self.assertIsNotNone(j['classId'])
                if j['classId'] == str(groupid_xingzheng):
                    self.assertIsNotNone(j['className'])
                    self.assertTrue(j['numberOfStudent'] > 5)
                    self.assertIn(j['classType'], (1, 2))

    def test_p1_sbrlive_getLiveInfo(self):
        """
        title: 查看直播信息
        url: /api/netschool/sbrlive/getLiveInfo
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_getLiveInfo(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(liveInfo, res['data'])

    def test_p1_1_sbrlive_pageQueryMyLive(self):
        """
        title: 我的直播_根据直播Id查询
        url: /api/netschool/sbrlive/pageQueryMyLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQueryMyLive(liveId=liveId, liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(1, res['totalRecords'])
        self.assertEqual(liveInfo['id'], res['data'][0]['id'])
        self.assertEqual(liveInfo['liveName'], res['data'][0]['liveName'])
        self.assertEqual(liveInfo['startTime'], res['data'][0]['startTime'])
        self.assertEqual(liveInfo['finishTime'], res['data'][0]['finishTime'])
        self.assertEqual(str(teacher_web.client.user_id), res['data'][0]['teacherId'])
        self.assertEqual(2, res['data'][0]['liveStatus'])
        self.assertEqual(3, res['data'][0]['liveDetailStatus'])
        self.assertTrue(res['data'][0]['numberOfStudent'] > 5)

    def test_p1_2_sbrlive_pageQueryMyLive(self):
        """
        title: 我的直播_根据直播名称查询
        url: /api/netschool/sbrlive/pageQueryMyLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQueryMyLive(liveName=liveInfo['liveName'], liveStatus="", pageIndex=1,
                                                  pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['totalRecords'] >= 1)
        for i in res['data']:
            self.assertIn(liveInfo['liveName'], res['data'][0]['liveName'])

    def test_p1_3_sbrlive_pageQueryMyLive(self):
        """
        title: 我的直播_时间段筛选直播
        url: /api/netschool/sbrlive/pageQueryMyLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQueryMyLive(startTime=liveInfo['startTime'], finishTime=liveInfo['finishTime'],
                                                  liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['totalRecords'] >= 1)
        for i in res['data']:
            self.assertTrue(liveInfo['startTime'] <= i['startTime'])
            self.assertTrue(i['startTime'] <= liveInfo['finishTime'])

    def test_p1_4_sbrlive_pageQueryMyLive(self):
        """
        title: 我的直播_筛选出已截止的直播
        url: /api/netschool/sbrlive/pageQueryMyLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQueryMyLive(liveStatus=2, pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['totalRecords'] >= 1)
        for i in res['data']:
            self.assertTrue(2, i['liveStatus'])

    def test_p1_5_sbrlive_pageQueryMyLive(self):
        """
        title: 我的直播_混合查询
        url: /api/netschool/sbrlive/pageQueryMyLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQueryMyLive(liveId=liveId, liveName=liveInfo['liveName'],
                                                  startTime=liveInfo['startTime'],
                                                  finishTime=liveInfo['finishTime'], liveStatus=2, pageIndex=1,
                                                  pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(1, res['totalRecords'])
        for i in res['data']:
            self.assertTrue(2, i['liveStatus'])
            self.assertIn(liveInfo['liveName'], res['data'][0]['liveName'])

    def test_p1_1_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_无条件查询
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(len(res['data']) >= 1)

    def test_p1_2_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_根据liveId筛选直播
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveId=liveId, liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(1, res['totalRecords'])
        self.assertEqual(liveInfo['id'], res['data'][0]['id'])
        self.assertEqual(liveInfo['liveName'], res['data'][0]['liveName'])
        self.assertEqual(liveInfo['startTime'], res['data'][0]['startTime'])
        self.assertEqual(liveInfo['finishTime'], res['data'][0]['finishTime'])
        self.assertEqual(str(teacher_web.client.user_id), res['data'][0]['teacherId'])
        self.assertEqual(2, res['data'][0]['liveStatus'])
        self.assertTrue(res['data'][0]['numberOfStudent'] > 5)

    def test_p1_3_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_根据直播名称查询
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveName=liveInfo['liveName'], liveStatus="", pageIndex=1,
                                                      pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['totalRecords'] >= 1)
        for i in res['data']:
            self.assertIn(liveInfo['liveName'], res['data'][0]['liveName'])

    def test_p1_4_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_混合查询
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveId=liveId, liveName=liveInfo['liveName'],
                                                      startTime=liveInfo['startTime'],
                                                      finishTime=liveInfo['finishTime'], liveStatus=2, pageIndex=1,
                                                      pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(1, res['totalRecords'])
        for i in res['data']:
            self.assertTrue(2, i['liveStatus'])
            self.assertIn(liveInfo['liveName'], res['data'][0]['liveName'])

    def test_p1_5_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_年级主任显示对应年级的校内直播列表
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=grademaster_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(len(res['data']) >= 1)
        self.assertEqual(len(res['data']), res['totalRecords'])

    def test_p1_6_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_班主任显示对应管理班级的直播列表
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=headteacher_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(len(res['data']) >= 1)
        self.assertEqual(len(res['data']), res['totalRecords'])

    def test_p1_7_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_心理老师直播列表空
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=psychologicalteacher_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(0, len(res['data']))
        self.assertEqual(len(res['data']), res['totalRecords'])

    def test_p1_8_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_教学班主任老师直播列表空
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=classheadteacher_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(0, len(res['data']))
        self.assertEqual(len(res['data']), res['totalRecords'])

    def test_p1_9_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_任课老师直播列表空
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=teacher_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(0, len(res['data']))
        self.assertEqual(len(res['data']), res['totalRecords'])

    def test_p1_10_sbrlive_pageQuerySchoolLive(self):
        """
        title: 校内直播列表_混合角色显示直播列表
        url: /api/netschool/sbrlive/pageQuerySchoolLive
        author: 章志君
        """
        teacher_web = teacher(web_client(username=teacher_mix_user['username']))
        res = teacher_web.sbrlive_pageQuerySchoolLive(liveStatus="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(len(res['data']) >= 1)
        self.assertEqual(len(res['data']), res['totalRecords'])

    def test_p1_sbrlive_getLiveToken(self):
        """
        title: 获取直播令牌信息(c端)
        url: /api/netschool/sbrlive/getLiveToken
        author: 章志君
        """
        teacher_web = teacher(web_client(username=student_user['username'], password=student_user['password']))
        res = teacher_web.sbrlive_getLiveToken(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertIsNotNone(res['data']['adminUserId'])
        self.assertIsNotNone(res['data']['roomId'])
        self.assertIsNotNone(res['data']['viewerName'])
        self.assertIsNotNone(res['data']['viewerCustomua'])
        self.assertIsNotNone(res['data']['viewerToken'])
        self.assertIn(str(teacher_web.client.user_id), res['data']['viewerToken'])

    def test_p1_sbrlive_getTeacherLiveToken(self):
        """
        title: 获取直播令牌信息(讲师)
        url: /api/netschool/sbrlive/getTeacherLiveToken
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_getTeacherLiveToken(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertIsNotNone(res['data']['adminUserId'])
        self.assertIsNotNone(res['data']['roomId'])
        self.assertIsNotNone(res['data']['realName'])
        self.assertIsNotNone(res['data']['publisherPass'])
        teacher_web = teacher(web_client(username=student_user['username'], password=student_user['password']))
        res2 = teacher_web.sbrlive_getLiveToken(liveId=liveId)
        self.assertIsNotNone(res['data']['roomId'], res2['data']['roomId'])

    @unittest.skipIf(get_env() != 'prod', '线下跳过((仅线上,测试环境没数据-cc只提供了一套环境))')
    def test_p1_sbrlive_listLiveRecord(self):
        """
        title: 查询直播的回放列表
        url: /api/netschool/sbrlive/listLiveRecord
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_listLiveRecord(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertIsNotNone(res['data']['roomId'])
        self.assertTrue(len(res['data']['recordList']) >= 1)

    def test_p1_sbrlive_listLiveState(self):
        """
        title: 根据直播id列表查询直播状态(c端)
        url: /api/netschool/sbrlive/listLiveState
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res2 = teacher_web.sbrlive_pageQueryMyLive(liveStatus="", pageIndex=1, pageSize=100)
        liveIds = [i['id'] for i in res2['data']]
        res = teacher_web.sbrlive_listLiveState(liveIdList=liveIds)
        print(res)
        self.assertEqual("200", res['code'])
        for i in res['data']:
            self.assertIn(i['liveId'], liveIds)
            self.assertIn(i['state'], [0, 1, 2, 3])

    def test_p1_sbrlive_uncompleted(self):
        """
        title: 直播未参与学生
        url: /api/netschool/sbrlive/uncompleted
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_uncompleted(liveId=liveId, classId="", pageIndex=1, pageSize=100)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['totalRecords'] > 1)
        self.assertEqual(len(res['data']), res['totalRecords'])
        classIds = [i['classId'] for i in res['data']]
        self.assertIn(str(groupid_xingzheng), classIds)
        for i in res['data']:
            self.assertIsNotNone(i['studentId'])
            self.assertIsNotNone(i['studentName'])

    def test_p1_sbrlive_arrangingClassList(self):
        """
        title: 直播布置到的全部班级
        url: /api/netschool/sbrlive/arrangingClassList
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_arrangingClassList(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        classIds = [i['classId'] for i in res['data']]
        classNames = [i['className'] for i in res['data']]
        res2 = teacher_web.class_listClassesContainDisbanded(classIdList=[groupid_xingzheng])
        print(res2)
        self.assertIn(res2['data'][0]['classId'], classIds)
        self.assertIn(res2['data'][0]['className'], classNames)

    @unittest.skipIf(get_env() != 'prod', '线下跳过((仅线上,测试环境没数据-cc只提供了一套环境))')
    def test_p1_sbrlive_overview(self):
        """
        title: 直播概况
        url: /api/netschool/sbrlive/statistics/overview
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_overview(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(str(liveId), res['data']['liveId'])
        self.assertTrue(res['data']['totalCount'] > 5)
        self.assertTrue(res['data']['participateCount'] >= 1)
        self.assertTrue(res['data']['maxConcurrentCount'] >= 1)
        self.assertTrue(res['data']['averageDuration'] >= 100)

    @unittest.skipIf(get_env() != 'prod', '线下跳过((仅线上,测试环境没数据-cc只提供了一套环境))')
    def test_p1_sbrlive_online(self):
        """
        title: 直播在线人数
        url: /api/netschool/sbrlive/statistics/online
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_online(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual(str(liveId), res['data']['liveId'])
        self.assertTrue(len(res['data']['onlineStatistics']) > 2)
        for i in res['data']['onlineStatistics']:
            self.assertIsNotNone(i['moment'])
            self.assertTrue(i['connectionCount'] >= 1)

    @unittest.skipIf(get_env() != 'prod', '线下跳过((仅线上,测试环境没数据-cc只提供了一套环境))')
    def test_p1_sbrlive_details(self):
        """
        title: 直播明细
        url: /api/netschool/sbrlive/statistics/details
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        teacher_web2 = teacher(web_client(username=student_user['username'], password=student_user['password']))
        res = teacher_web.sbrlive_details(liveId=liveId, classId=groupid_xingzheng, pageIndex=1, pageSize=20)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(len(res['data']) >= 1)
        self.assertEqual(str(groupid_xingzheng), res['data'][0]['classId'])
        self.assertEqual(str(teacher_web2.client.user_id), res['data'][0]['studentId'])
        self.assertTrue(res['data'][0]['completion'] > 10)
        self.assertTrue(int(res['data'][0]['watchTime']) > 10)
        self.assertTrue(res['data'][0]['enterLeaveCount'] >= 1)
        self.assertTrue(res['data'][0]['chatCount'] >= 1)
        self.assertTrue(res['data'][0]['rollcallCount'] >= 1)

    @unittest.skipIf(get_env() != 'prod', '线下跳过((仅线上,测试环境没数据-cc只提供了一套环境))')
    def test_p1_sbrlive_getRecordAvgDuration(self):
        """
        title: 获取回放的平均观看时长
        url: /api/netschool/sbrlive/statistics/getRecordAvgDuration
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_getRecordAvgDuration(liveId=liveId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(int(res['data']['avgDuration']) >= 1)
        self.assertTrue(int(res['data']['unCompleteAvgDuration']) >= 1)

    @unittest.skipIf(get_env() != 'prod', '线下跳过((仅线上,测试环境没数据-cc只提供了一套环境))')
    def test_p1_sbrlive_pageQueryRecordDetails(self):
        """
        title: 分页查询回放观看明细
        url: /api/netschool/sbrlive/statistics/pageQueryRecordDetails
        author: 章志君
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.sbrlive_pageQueryRecordDetails(liveId=liveId, classId=0, order=0, pageIndex=1, pageSize=20)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertTrue(res['totalRecords'] > 0)
        self.assertIn(str(groupid_xingzheng), str(res['data']))
        for i in res['data']:
            self.assertIsNotNone(i['userId'])
            self.assertIsNotNone(i['duration'])
            self.assertIsNotNone(i['rate'])
示例#7
0
from config.config_env import get_env

svip_account = "qianshui" if get_env() == 'prod' else "qianyan"
unreactivated_account = "qianwan" if get_env() == 'prod' else "qianhe"
QQopenId = "B7A0621A87508E323DD098F279499336" if get_env(
) == 'prod' else "72F8A3C4625EE2171814CF078000D883"
mobile = "15088738891" if get_env() == 'prod' else '15011223344'
userid = "13726882" if get_env() == 'prod' else '100113705'
ontrial = "zpyxs315410" if get_env() == 'prod' else 'kcg200918001'
示例#8
0
from config.config_env import get_env

basketforteaaddinput1 = [{
    "qid": 2397,
    "kemu": "10",
    "typeid": 1
}] if get_env() != "prod" else [{
    "qid": 24525,
    "kemu": "10",
    "typeid": 1
}]
basketforteaaddinput2 = [{"qid": 2355, "kemu": "10", "typeid": 1}, {"qid": 2356, "kemu": "10", "typeid": 1},
                         {"qid": 2357, "kemu": "10", "typeid": 1}] \
    if get_env() != "prod" else [{"qid": 24584, "kemu": "10", "typeid": 1}, {"qid": 24585, "kemu": "10", "typeid": 1},
                                 {"qid": 24602, "kemu": "10", "typeid": 1}]

typelist = [{'id': 17, 'title': '生涯规划',
             'childlist': [{'id': 17, 'title': '全部'}, {'id': 29, 'title': '认识自我'}, {'id': 31, 'title': '学会决策'},
                           {'id': 32, 'title': '学会管理'}, {'id': 49, 'title': '认识世界'}]}, {'id': 18, 'title': '志愿填报',
                                                                                        'childlist': [
                                                                                            {'id': 18, 'title': '全部'},
                                                                                            {'id': 33, 'title': '填报常识'},
                                                                                            {'id': 34, 'title': '填报技巧'},
                                                                                            {'id': 35,
                                                                                             'title': '填报案例'}]},
            {'id': 19, 'title': '大学风采', 'childlist': []}, {'id': 20, 'title': '职业介绍', 'childlist': []},
            {'id': 21, 'title': '专业解读',
             'childlist': [{'id': 21, 'title': '全部'}, {'id': 37, 'title': '工学'}, {'id': 38, 'title': '法学'},
                           {'id': 39, 'title': '教育学'}, {'id': 40, 'title': '经济学'}, {'id': 41, 'title': '文学'},
                           {'id': 42, 'title': '管理学'}, {'id': 43, 'title': '历史学'}, {'id': 44, 'title': '医学'},
                           {'id': 45, 'title': '农学'}, {'id': 46, 'title': '艺术学'}, {'id': 47, 'title': '理学'},
示例#9
0
    'description': '化学'
}, {
    'value': 6,
    'description': '生物'
}, {
    'value': 7,
    'description': '政治'
}, {
    'value': 8,
    'description': '历史'
}, {
    'value': 9,
    'description': '地理'
}]

if get_env() == 'prod':
    cellphone1 = 14100000003  #无职务,用于老师管理-添加老师删除老师
    userIdTest1 = 112421139  #手机号14100000003对应的userId
    cellphone = 14100000004  #校长,密码会变(发送短信case),用于OA编辑老师、发送短信等case
    userIdTest = 112421147  #手机号14100000004对应的userId
    cellphone3 = 14100000006  #非老师
    classIdTest = 1018921  #oa_teacher_test.py 添加老师任课老师时选择班级用
    schoolconf = [{
        'key': 'SCHOOL_BASED_VIDEO_PERMISSION',
        'value': 'true'
    }, {
        'key': 'LIGHT_WEIGHT_ONLINE_SCHOOL_PERMISSION',
        'value': 'true'
    }, {
        'key': 'SCHOOL_BASED_PAPERS_PERMISSION',
        'value': 'true'
示例#10
0
from config.config_env import get_env

sbr_paperid = 24160 if get_env() == 'prod' else 199

syllabuses_expect = [{
    'no':
    1,
    'title':
    '一、选择题',
    'type':
    1,
    'totalscore':
    40.0,
    'questioncnt':
    4,
    'details': [{
        'questionid':
        268653524,
        'no':
        1,
        'type':
        1,
        'correct':
        0,
        'totalscore':
        0.0,
        'score':
        None,
        'options': [{
            'iscorrect': False,
            'chosed': False,
示例#11
0
class ContentsTest(TestCaseV2):
    @classmethod
    def setUpClass(cls):
        pass

    @classmethod
    def tearDownClass(cls):
        pass

    def test_p1_get_menuall(self):
        """
        title: 验证微信端的/menu/all(获取菜单)接口
        url: /api/eteacherproduct/menu/all
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        token = teacher_web.client.user_token
        res = teacher_web.menuall(token=token)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])
        self.assertTrue(len(res['data']) > 0)

    def test_p1_get_menuselect(self):
        """
        title: 验证微信端的/menu/select(设置教学进度)接口
        url: /api/eteacherproduct/menu/select
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.menuselect(menuId=menu_menuId,
                                     subjectId=menu_subjectId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])

    def test_p1_get_solutionlist_1(self):
        """
        title: 验证微信端的/solution/list(方案列表)接口,check点:非直连方式
        url: /api/eteacherproduct/solution/list
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.solutionlist(menuId=menu_menuId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])
        # 目录方式
        connectedMode1 = [
            s['connectedMode'] for s in res['data']['data']
            if s['id'] == solutionid1
        ]
        self.assertEqual(1, connectedMode1[0])

    @unittest.skipIf(get_env() == 'prod', '线上暂时跳过(无数据)')
    def test_p1_get_solutionlist_2(self):
        """
        title: 验证微信端的/solution/list(方案列表)接口,check点:直连方式
        url: /api/eteacherproduct/solution/list
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.solutionlist(menuId=menu_menuId)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])
        # 专题直连方式
        connectedMode1 = [
            s['connectedMode'] for s in res['data']['data']
            if s['id'] == solutionid2
        ]
        self.assertEqual(2, connectedMode1[0])

    def test_p1_get_topicdetail(self):
        """
        title: 验证微信端的topicDetail(专题详情)接口,check点:返回url
        url: /api/eteacherproduct/solution/content/topicDetail
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.topicdetail(topicId=Id)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])
        self.assertTrue(len(res['data']['h5url']) > 0)
        self.assertTrue(len(res['data']['pcurl']) > 0)

    @unittest.skipIf(get_env() == 'prod', '线上暂时跳过(数据不一致)')
    def test_p1_get_solutioncontent_test(self):
        """
        title: 验证微信端的contents(内容获取)接口,check点:视频、试卷、专题类型字段
        url: /api/eteacherproduct/solution/contents
        author: 吴丽燕
        """
        # 专题内容获取(验证视频、试卷、专题)
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.solutioncontent(solutionId=solutionid1)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])
        self.assertEqual(
            1,
            res['data']['solution']['subList'][2]['content'][1]['contentType'])
        self.assertEqual(
            2,
            res['data']['solution']['subList'][2]['content'][0]['contentType'])
        self.assertEqual(
            3,
            res['data']['solution']['subList'][3]['content'][1]['contentType'])

    @unittest.skipIf(get_env() != 'prod', '线下暂时跳过(数据不一致)')
    def test_p1_get_solutioncontent_prod(self):
        """
        title: 验证微信端的contents(内容获取)接口,check点:视频、试卷类型字段
        url: /api/eteacherproduct/solution/contents
        author: 吴丽燕
        """
        # 专题内容获取(验证视频、试卷、专题)
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.solutioncontent(solutionId=solutionid1)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])
        self.assertEqual(
            1,
            res['data']['solution']['subList'][0]['content'][0]['contentType'])
        self.assertEqual(
            2,
            res['data']['solution']['subList'][8]['content'][0]['contentType'])

    def test_p1_get_solutionintroduce(self):
        """
        title: 验证微信端的introduce(内容介绍)接口
        url: /api/eteacherproduct/solution/introduce
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.solutionintroduce(solutionId=Id)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])

    def test_p1_get_papergetquestions(self):
        """
        title: 验证微信端的获取试卷题目接口
        url: /api/homeworkprod/resource/paper/getPaperInfo
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.homeworkprod_getPaperInfo(paperId=paperId,
                                                    schoolId=schoolid)
        print(res)
        self.assertEqual(res['code'], '200')
        self.assertTrue(len(res['data']['questionList']) > 0)
        self.assertTrue(
            len(res['data']['questionList'][0]['questionContent']) > 0)

    def test_p1_get_createpaper(self):
        """
        title: 验证微信端的组卷接口
        url: /api/paperlibrary/createpaper
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        questions = teacher_web.homeworkprod_getPaperInfo(paperId=paperId,
                                                          schoolId=schoolid)
        selectedquestions = []
        selectedquestions.append(
            questions['data']['questionList'][0]['questionId'])
        selectedquestions.append(
            questions['data']['questionList'][1]['questionId'])
        post_data = {"questionIdList": selectedquestions, "subjectId": 1}
        res = teacher_web.homeworkprod_generatePaperByQuestionList(post_data)
        print(res)
        self.assertEqual(res['code'], '200')
        self.assertTrue(res['success'])
        self.assertTrue(res['data'])

    def test_p1_get_getclasseswithgradeinfo(self):
        """
        title: 验证获取班级接口,check:验证只能获取到行政班+对应学科的教学班,withSpecialTopic字段只是用于前端
        url: /api/services/HomeworkService/weChatHomework/GetClassesWithGradeInfo
        author: 吴丽燕
        """
        teacher_web = teacher(web_client(username=principal_user['username']))
        res = teacher_web.wxgetclasseswithgradeinfo(subjectId=assign_subjectId,
                                                    withSpecialTopic="false")
        print(res)
        self.assertTrue(res['code'], 200)
        # 判断返回的是行政班+对应学科的教学班
        for grades in res['data']['grades']:
            for classes in grades['classes']:
                improvedsubject = [0, assign_subjectId]
                self.assertTrue(
                    set([classes['subject']]).issubset(set(improvedsubject)))

    def test_p1_get_assign_gradehomework(self):
        """
        title: 验证年级立即布置视频1、试卷2、专题3作业
        url: /api/services/HomeworkService/weChatHomework/GetClassesWithGradeInfo, /api/eteacherproduct/homework/assignment
        author: 吴丽燕
        """
        # todo 最好通过学生的作业列表来check
        teacher_web = teacher(web_client(username=principal_user['username']))
        arrangeType = 0  # arrangeType立即布置:0;定时布置:1;
        classType = 1  # classType行政班:1;教学班:2
        components = []
        # 试卷信息
        components.append({
            "title": paper_title,
            "type": 2,
            "refIds": paper_refIds,
            "count": 0
        })
        # 多个视频作业
        components.append({
            "title": video_title,
            "type": 1,
            "refIds": video_refIds
        })
        # 专题作业
        components.append({
            "title": topic_title,
            "type": 3,
            "refIds": topic_refIds,
            "count": 0
        })
        classinfo = teacher_web.wxgetclasseswithgradeinfo(
            subjectId=assign_subjectId, withSpecialTopic="false")
        expireYear = classinfo['data']['grades'][0]['classes'][0]['gradeyear']
        classList = classinfo['data']['grades'][0]['classes'][0]['classid']
        isGradeHomework = True
        gradeClasses = []
        currentClass = classinfo['data']['grades'][0]['classes'][0]
        expireYears = [expireYear]
        selectedClass = []
        subject = menu_subjectId
        solutionId = str(solutionid1)
        usetimes = 200
        startTime = int(round(time.time() * 1000))  # 当前时间
        deadline = startTime + 86400000
        res = teacher_web.homeworkassign(arrangeType, classType, components,
                                         isGradeHomework, gradeClasses,
                                         currentClass, expireYears,
                                         selectedClass, subject, solutionId,
                                         usetimes, startTime, deadline)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])

    def test_p1_get_assign_classhomework_arrangeType0(self):
        """
        title: 验证年级立即布置视频1、试卷2、专题3作业
        url: /api/services/HomeworkService/weChatHomework/GetClassesWithGradeInfo, /api/eteacherproduct/homework/assignment
        author: 吴丽燕
        """
        # todo 最好通过学生的作业列表来check
        teacher_web = teacher(
            web_client(username=headteacher_user['username']))
        arrangeType = 0  # arrangeType立即布置:0;定时布置:1;
        classType = 1  # classType行政班:1;教学班:2
        components = []
        # 试卷信息
        components.append({
            "title": paper_title,
            "type": 2,
            "refIds": paper_refIds,
            "count": 0
        })
        # 多个视频作业
        components.append({
            "title": video_title,
            "type": 1,
            "refIds": video_refIds
        })
        # 专题作业
        components.append({
            "title": topic_title,
            "type": 3,
            "refIds": topic_refIds,
            "count": 0
        })
        classinfo = teacher_web.wxgetclasseswithgradeinfo(
            subjectId=assign_subjectId, withSpecialTopic="false")
        expireYear = classinfo['data']['grades'][0]['classes'][0]['gradeyear']
        classList = classinfo['data']['grades'][0]['classes'][0]['classid']
        isGradeHomework = False
        gradeClasses = [{"expireYear": expireYear, "classList": [classList]}]
        currentClass = classinfo['data']['grades'][0]['classes'][0]
        expireYears = []
        selectedClass = []
        subject = menu_subjectId
        solutionId = str(solutionid1)
        usetimes = 200
        startTime = int(round(time.time() * 1000))  # 当前时间
        deadline = startTime + 86400000
        res = teacher_web.homeworkassign(arrangeType, classType, components,
                                         isGradeHomework, gradeClasses,
                                         currentClass, expireYears,
                                         selectedClass, subject, solutionId,
                                         usetimes, startTime, deadline)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])

    def test_p1_get_assign_classhomework_arrangeType1(self):
        """
        title: 验证班级定时布置视频1、试卷2、专题3作业
        url: /api/services/HomeworkService/weChatHomework/GetClassesWithGradeInfo, /api/eteacherproduct/homework/assignment
        author: 吴丽燕
        """
        # todo 最好通过教师的作业列表来check
        teacher_web = teacher(
            web_client(username=headteacher_user['username']))
        arrangeType = 1  # arrangeType立即布置:0;定时布置:1;
        classType = 1  # classType行政班:1;教学班:2
        components = []
        # 试卷信息
        components.append({
            "title": paper_title,
            "type": 2,
            "refIds": paper_refIds,
            "count": 0
        })
        # 多个视频作业
        components.append({
            "title": video_title,
            "type": 1,
            "refIds": video_refIds
        })
        # 专题作业
        components.append({
            "title": topic_title,
            "type": 3,
            "refIds": topic_refIds,
            "count": 0
        })
        classinfo = teacher_web.wxgetclasseswithgradeinfo(
            subjectId=assign_subjectId, withSpecialTopic="false")
        expireYear = classinfo['data']['grades'][0]['classes'][0]['gradeyear']
        classList = classinfo['data']['grades'][0]['classes'][0]['classid']
        isGradeHomework = False
        gradeClasses = [{"expireYear": expireYear, "classList": [classList]}]
        currentClass = classinfo['data']['grades'][0]['classes'][0]
        expireYears = []
        selectedClass = []
        subject = menu_subjectId
        solutionId = str(solutionid1)
        usetimes = 200
        startTime = int(round(time.time() * 1000) + 43200000)  # 当前时间+12h
        deadline = startTime + 86400000
        res = teacher_web.homeworkassign(arrangeType, classType, components,
                                         isGradeHomework, gradeClasses,
                                         currentClass, expireYears,
                                         selectedClass, subject, solutionId,
                                         usetimes, startTime, deadline)
        print(res)
        self.assertEqual("200", res['code'])
        self.assertEqual("操作成功", res['msg'])
示例#12
0
from config.config_env import get_env

ENV = get_env()

oa_uid = 412
expireyear = 2020
grade = 3
schoolid = 25729
current_school_year = 2020
# 校长账号
principal_user = {'username': '******', 'password': '******'}
new_senior_user = {'username': '******', 'password': '******'}
# 心理老师账号
psychologicalteacher_user = {'username': '******', 'password': '******'}
# 行政班班主任账号
headteacher_user = {'username': '******', 'password': '******'}
# 年级主任账号
grademaster_user = {'username': '******', 'password': '******'}
# g1年级主任账号
grademaster_user_of_g1 = {'username': '******', 'password': '******'}
# 学科老师账号
teacher_user = {'username': '******', 'password': '******'}
# 无角色老师账号
normalteacher_user = {'username': '******', 'password': '******'}
# 教学班班主任账号
classheadteacher_user = {'username': '******', 'password': '******'}
# 混合角色老师账号(既担任校领导,又担任多个老师角色)
teacher_mix_user = {'username': '******', 'password': '******'}
# 行政班班级id(行政班班主任所管理的班级)
groupid_xingzheng = 543529
# 教学班班级id
示例#13
0
from config.config_env import get_env

new_evalution_id = 100000 if get_env() == 'prod' else 100001

if get_env() == 'prod':
    submit_url = 'http://gateway.ewt360.com/api/evaluation/eval/post/user/record'
    question_list_url = 'http://gateway.ewt360.com/api/evaluation/eval/get/user/questionlist'
    report_url = 'http://gateway.ewt360.com/api/evaluation/eval/get/group/report'

else:
    submit_url = 'http://10.0.11.86:8769/api/evaluation/eval/post/user/record'
    question_list_url = 'http://10.0.11.86:8769/api/evaluation/eval/get/user/questionlist'
    report_url = 'http://10.0.11.86:8769/api/evaluation/eval/get/group/report'
示例#14
0
from config.config_env import get_env
from testcases.api_testcases.b_end_testcases.schooluser_data import current_school_year

# expireyear = 2020
# studentzzj_user = {'username': '******', 'password': '******'}
student_name = '田彦涛a'
classinfo = {
    'classId': 173713,
    'className': '新高一(1)班'
} if get_env() != 'prod' else {
    'classId': 907448,
    'className': '高一(1)班'
}

# 3+3 自由选科
# subjectlist_33_1 = [{"id":1,"name":"物理"},{"id":2,"name":"化学"},{"id":3,"name":"生物"},{"id":4,"name":"历史"},{"id":5,"name":"地理"},{"id":6,"name":"政治"},{"id":7,"name":"技术"}]
subjectlist_33_1 = [{
    "id": 8,
    "name": "物理"
}, {
    "id": 9,
    "name": "化学"
}, {
    "id": 10,
    "name": "生物"
}, {
    "id": 11,
    "name": "历史"
}, {
    "id": 12,
    "name": "地理"
示例#15
0
import requests
from config.config_env import get_env

user_vip = {
    "username": '******',
    "password": '******'
} if get_env() == 'prod' else {
    "username": '******',
    "password": '******'
}
# qbank的数据池
questionIdList = [
    1683946698346446966, 1683946698346446995, 2683947583109709925,
    2683947583109709926, 2683947608879513602
] if get_env() == 'prod' else [2678819443697336324]


def get_login_for_admin():
    admin_url = 'http://admin.mistong.com/api/ssoprod/auth/preLogin'
    try:
        headers = {"Content-Type": "application/json"}
        params = {"username": "******", "password": "******"}
        response = requests.post(url=admin_url,
                                 headers=headers,
                                 json=params,
                                 timeout=20)  # 设置超时
        response.raise_for_status()
        response.encoding = response.apparent_encoding
        if response.status_code == 200:
            result = response.json()['data']
            # base_operationdb_interface.op_sql("UPDATE token_total set value_config='%s' where id=4" % (result))