示例#1
0
import threading
import unittest
from time import sleep

from bs4 import BeautifulSoup
import hashlib
import json
import requests
import time
import FF_Joy188

from utils import Config, Logger
from utils.Config import LotteryData, func_time

logger = Logger.create_logger(r"\AutoTest", 'auto_test_pc')
COOKIE = None  # 以全域變數儲存,以利在各測試間共用
MUL = None
MUL_ = None


class ApiTestPC(unittest.TestCase):
    """PC接口測試"""
    __slots__ = '_env_config', '_user', '_red_type', '_money_unit', '_award_mode', \
                '_header', '_post_url', '_en_url', '_third_list'
    SESSION = requests.Session()

    def setUp(self):
        global COOKIE
        logger.info(f'ApiTestPC setUp : {self._testMethodName}')
        if COOKIE:  # 若已有Cookie則加入Header
            logger.info('已有Cookie')
示例#2
0
from bs4 import BeautifulSoup
import json, cx_Oracle, requests, hashlib, time, urllib3, time
from fake_useragent import UserAgent

from utils import Logger
from utils.Config import LotteryData, EnvConfig
from utils.Connection import OracleConnection


logger = Logger.create_logger(r"\AutoTest", 'FF_')


class FF_:  # 4.0專案

    def __init__(self):
        self.dev_url = ['dev02', 'dev03', 'fh82dev02', '88hlqpdev02', 'teny2020dev02']
        self.uat_url = ['joy188', 'joy188.195353']
        self.user_agent = {
            'Pc': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) \
        Chrome/68.0.3440.100 Safari/537.36",
            'Ios': "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 \
        (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
            'Andorid': "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 \
        (KHTML, like Gecko) Chrome/70.0.3538.110 Mobile Safari/537.36",
            'Fake': UserAgent(verify_ssl=False).random
        }

        self.param = b'ba359dddc3c5dfd979169d056de72638',  # 固定寫死即可
        self.session = requests.Session()
        # self.session.proxies = {"http": "http://127.0.0.1:8888"}
        self.lottery_dict = LotteryData.lottery_dict  # 吃config ,後續只需增加一邊