def test_8(): munreq = 3000 aquests.configure(10, callback=increase, force_http1=True) for i in range(munreq): aquests.get(SERVER) aquests.fetchall() assertEqual(checkout(), munreq)
def test_9(): munreq = 3000 aquests.configure(2, callback=increase, http2_constreams=5) for i in range(munreq): aquests.get(SERVER) aquests.fetchall() assertEqual(checkout(), munreq)
def test_makeload (): aquests.configure (CONCURRENT, callback = makeload) # cioncurrent for i in range (CONCURRENT): aquests.get ("http://127.0.0.1:5000/", meta = {'_id': _ID}) _ID += 1 aquests.fetchall ()
def test_mix_get_mongodb(): dbo = aquests.mongodb("127.0.0.1:27017", "test_database") aquests.configure(20) for i in range(1000): aquests.get("http://127.0.0.1:5000/") dbo.findone("posts", {"author": "Hans Roh"}) aquests.fetchall()
def test_get_https(): aquests.configure(force_http1=1) aquests.get("https://www.facebook.com/") aquests.fetchall() aquests.configure(force_http1=0) aquests.get("https://www.facebook.com/") aquests.fetchall()
def request_finished_and_req(r): global TOTAL, DONE DONE += 1 if TOTAL >= 10 and DONE % int(TOTAL / 10) == 0: aquests.log("progress: {:.0f}%".format(DONE / TOTAL * 100)) args = (r.status_code, r.reason, len(r.content)) #print ("%s %s %d bytes received" % args, r.version) if (DONE + len(aquests._currents) + aquests.qsize()) < TOTAL: aquests.get(r.url)
def makeset (https = 0, http2 = False): server = (https and "https" or "http") + "://127.0.0.1:30371" jpg = open (os.path.join (confutil.getroot (), "statics", "reindeer.jpg"), "rb") targets = ("/", "/hello", "/redirect1", "/redirect2", "/documentation", "/documentation2") for url in targets: aquests.get (server + url) aquests.get (server +"/members/", auth = ('admin', '1111')) aquests.post (server + "/post", {"username": "******"}) aquests.upload (server +"/upload", {"username": "******", "file1": jpg}) stub = aquests.rpc (server +"/rpc2/") stub.add_number (5, 7) if http2 and GRPC: stub = aquests.grpc (server +"/routeguide.RouteGuide/") point = route_guide_pb2.Point (latitude=409146138, longitude=-746188906) stub.GetFeature (point)
def test_load(h1, client, streams, urls): if urls == 1: aquests.configure(client, callback=request_finished, force_http1=h1, http2_constreams=streams) for i in range(TOTAL): make_example_testset() else: aquests.configure(client, callback=request_finished_and_req, force_http1=h1, http2_constreams=streams, backend=True) for i in range(client * streams): for url in urls: aquests.get(url) aquests.fetchall()
def test_dns_error(): ERRS = 0 aquests.configure(1, callback=assert_status, force_http1=1) [ aquests.get("http://sdfiusdoiksdflsdkfjslfjlsf.com", meta={"expect": 704}) for i in range(2) ] aquests.fetchall() assert ERRS == 0
def make_example_testset(): if os.path.isfile(r"D:\apps\skitai\tests\examples"): jpg = open( os.path.join(r"D:\apps\skitai\tests\examples", "statics", "reindeer.jpg"), "rb") aquests.upload("http://127.0.0.1:5000/upload", { "username": "******", "file1": jpg }) aquests.get("http://127.0.0.1:5000/") aquests.get("http://127.0.0.1:5000/members/", auth=('admin', '1111')) aquests.get("http://127.0.0.1:5000/redirect1") aquests.rpc("http://127.0.0.1:5000/rpc2/").add_number(1, 2) aquests.ws("ws://127.0.0.1:5000/websocket/echo-single", "Hello Skitai")
def test_get_301_h2c(): aquests.configure(callback=finish_request) for i in range(1): aquests.get("http://127.0.0.1:5000/redirect1") aquests.fetchall()
def make_stream_set(https=0): server = (https and "https" or "http") + "://127.0.0.1:30371" aquests.get(server + "/documentation") aquests.get(server + "/documentation2") aquests.get(server + "/documentation3")
def test_6(): aquests.configure(1, callback=equal404) aquests.get(SERVER + "/no-page") aquests.fetchall()
def test_get(): aquests.configure(1, callback=request_finished) aquests.get("https://gitlab.com/hansroh") aquests.fetchall()
def test_auth_bearer (): aquests.configure (force_http1 = 1, timeout = 20) for i in range (1): aquests.get ("http://localhost:5000/lb/board/lists/?id=classic&page=1", auth = ("12345678-1234-123456",)) aquests.fetchall ()
def test_2(): aquests.configure(1, callback=ver20) aquests.get(SERVER) aquests.fetchall()
def test_7(): aquests.configure(1, callback=equal404, force_http1=True) aquests.get(SERVER + "/no-page") aquests.fetchall()
def test_timeout (): aquests.configure (1, timeout = 3) aquests.get ("http://127.0.0.1:5000/test/sleep/20") aquests.fetchall ()
def get_all_20_cs10(): aquests.configure(2000, http2_constreams=1, force_http1=1) for i in range(3000): aquests.get("http://127.0.0.1:5000/") aquests.fetchall()
def test_get_404(): for i in range(3): aquests.get("http://127.0.0.1:5000/routeguide.RouteGuide_") aquests.fetchall()
def test_get_all_static(): aquests.configure(2, callback=None, force_http_11=False) for i in range(200): aquests.get("http://127.0.0.1:5000/images/gif1.gif") #aquests.get ("http://127.0.0.1:5000/images/concept.png") aquests.fetchall()
def test_get_301_h2(): aquests.configure(callback=finish_request, allow_redirects=1) for i in range(1): aquests.get("https://www.google.com/") aquests.fetchall()
def test_get_static(): aquests.get("http://127.0.0.1:5000/images/gif1.gif") aquests.fetchall()
def makeload (response): global _ID print (response.meta ['_id'], response.code, response.msg, response.version) if aquests.countreq () < MAX_REQ: aquests.get ("http://127.0.0.1:5000/", meta = {'_id': _ID}) _ID += 1
def test_get_301 (): for i in range (1): aquests.get ("http://pypi.python.org") aquests.fetchall ()
def test_cookie(): aquests.configure(1, cookie=True, callback=request_finished) aquests.get( "https://www.google.co.kr/?gfe_rd=cr&ei=3y14WPCTG4XR8gfSjoK4DQ") aquests.get("https://aws.amazon.com/") aquests.fetchall()
def test_3(): aquests.configure(1, callback=ver11, force_http1=True) aquests.get(SERVER) aquests.fetchall()
def test_get_401(): aquests.configure(callback=finish_request, force_http1=0) for i in range(1): aquests.get("http://127.0.0.1:5000/", auth=('admin', '1111')) aquests.fetchall()
def test_dns (): aquests.configure (1, callback = request_finished) aquests.get ("http://rdsapi.skitai.com:5000/") aquests.fetchall ()
def test_get2(): aquests.get("https://pypi.python.org/pypi?name=aquests") aquests.get("https://www.google.co.kr/search?q=aquests") aquests.fetchall()