Пример #1
0
# @Author: pengjuan
# @interfacetest: http://apiv1.starschina.com/cms/v1.2/video

from common.configHttp import RunMain
from readConfig import ReadConfig
from common.configMysql import OperationDbInterface
from common.getSign import get_Sign
from common.AES_CBC import AES_CBC
from datetime import datetime
import common.url as url
import requests, unittest, json, time

baseurl = url.baseurl()
version = ReadConfig().get_app('version')
app_key = ReadConfig().get_app('app_key')
mysql = OperationDbInterface()
headers = RunMain().headers()
aes = AES_CBC()


class test_Video(unittest.TestCase):
    """测试点播接口"""
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.url = baseurl + "/cms/v1.2/video"
        self.content_video = mysql.select_one(
            'select video.id, video.title FROM video LEFT JOIN resource_param on video.id = resource_param.content_id'
            ' where resource_param.online = 1 and resource_param.app_id = 1 and resource_param.content_type = 1'
            ' ORDER BY RAND() LIMIT 1;')
        self.content_type = mysql.select_one(
            'select content_type from resource_param where content_id = %d' %
Пример #2
0
from common.md5_sms import timeStamp_md5
from common.configMysql import OperationDbInterface
from datetime import datetime
from common.AES_CBC import AES_CBC
from common.getSign import get_Sign
from common.configHttp import RunMain
import common.url as url
import unittest, json, requests, time

global false, null, true
baseurl = url.baseurl()
version = ReadConfig().get_app('version')
app_key = ReadConfig().get_app('app_key')
headers = RunMain().headers()
aes = AES_CBC()
mysql = OperationDbInterface()
md5 = timeStamp_md5()

global tycoon_id, video_id, tycoon_video, tycoon_name
tycoon_id = video_id = tycoon_video = tycoon_name = {}
tycoon_id = mysql.select_one(
    'select id from tycoon WHERE id in (SELECT tycoon_id from tycoon_video left join resource_param on '
    'tycoon_video.video_id = resource_param.content_id where resource_param.online = 1 '
    'and resource_param.app_id = 1 and resource_param.content_type = 1)ORDER BY RAND() limit 1;'
)
video_id = mysql.select_one(
    'select video_id from tycoon_video left join resource_param on '
    'tycoon_video.video_id = resource_param.content_id where resource_param.online = 1 '
    'and resource_param.app_id = 1 and resource_param.content_type = 1 and '
    'tycoon_id = %d ORDER BY RAND() limit 1;' % tycoon_id["id"])
tycoon_id.update(video_id)