示例#1
0
文件: case02.py 项目: demonzyz/ITest
 def runTest(self):
     """
     登录获取Token接口  异常用户名流程
     """
     url = 'http://127.0.0.1:8000/api/register/'
     username = ''
     password = '******'
     data = {
         'username': username,
         'password': encrypt.base64_encode(Random.get_str(3) + password)
     }
     response = requests.request('POST', url=url, data=data)
     result = response.json()
     assert result.get('error_code', None) == 10001, 'error_code不正确'
     assert result.get('token', None) == None, 'token不应该存在'
     print '用例执行成功'
示例#2
0
文件: case07.py 项目: demonzyz/ITest
 def runTest(self):
     """
     添加会议接口  正常流程
     """
     url = 'http://127.0.0.1:8000/api/add_event/'
     random = Random.get_str(5)
     token = 'd06da11c96d37f353fad887d7b49521db2e36b92'
     headers = {'token': token, 'random': random}
     data = {
         'title': '小米发布会',
         'time': '2017-11-25',
         'address': '地中海风情岛1',
         'username': '******'
     }
     sign = encrypt.get_sign(token, data, random)
     data['sign'] = sign
     response = requests.request('POST',
                                 url=url,
                                 headers=headers,
                                 data=data).json()
     assert response.get('error_code', None) == 0, 'error_code不正确'
     assert response.get('data', None).get('event_id',
                                           None) != None, 'event_id不正确'
     print '成功'
示例#3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @File Name: cfg.py
# @Created:   2017-11-27 23:26:09  seo ([email protected])
# @Updated:   2017-11-28 15:13:43  Simon Seo ([email protected])

from util import Random, Timekeeper

random = Random('random-numbers.txt')
tk = Timekeeper()
M = 0  #machine size in words. All available for page frames
P = 0  #page size in words.
S = 0  #size of each process, i.e., the references are to virtual addresses 0..S-1.
J = 0  #job mix, which determines A, B, and C, as described below.
N = 0  #number of references for each process.
R = ''  #replacement algorithm, LIFO (NOT FIFO), RANDOM, or LRU.'''
示例#4
0
 def __init__(self, algoName):
     self.tk = glb.tk = Timekeeper()  # Reset time
     self.algoName = algoName
     glb.r = Random(glb.rf)  # Reset Random numbers
示例#5
0
    hash ^= CASTLING_RNG_NUMBERS[castling_bits]

    if board.ep_square is not None:
        ep_bit = 0
        if chess.A3 <= board.ep_square <= chess.H3:
            ep_bit |= ((board.ep_square - 16) + 8)

        if chess.A6 <= board.ep_square <= chess.H6:
            ep_bit |= (board.ep_square - 40)

        hash ^= EN_PASSANT_RNG_NUMBERS[ep_bit]

    return hash


rnd = Random()


def rand_array(count):
    numbers = []
    for i in range(count):
        numbers.append(rnd.rand64())
    return numbers


def last_element_zero(elements):
    elements[len(elements) - 1] = np.uint64(0)
    return elements


PIECE_RNG_NUMBERS = rand_array(13 * 64)
示例#6
0
文件: case08.py 项目: demonzyz/ITest
#coding:utf-8
import sys

import requests
from util import Random
from util import encrypt

reload(sys)
sys.setdefaultencoding('utf8')
"""
查询会议接口  正常流程
"""
url = 'http://127.0.0.1:8000/api/get_eventlist/'
random = Random.get_str(5)
token = 'd06da11c96d37f353fad887d7b49521db2e36b92'
headers = {'token': token, 'random': random}
data = {'title': '小米发布会', 'username': '******'}
sign = encrypt.get_sign(token, data, random)
data['sign'] = sign
response = requests.request('GET', url=url, headers=headers, params=data).json()
assert response.get('error_code', None) == 0, 'error_code不正确'
assert response.get('event_list', None) != None, 'event_list不正确'
print '成功'