test_requests_async.py
This file
Path
test_requests_async.py
58 lines · 1.2 KiB · Python
Last changed by
Standard tests from RequestsTestSuite run using async apiPiotr Dobrogostbefore adoptionc430b60
History of this fileTake it
Standard tests from RequestsTestSuite run using async apiPiotr Dobrogostbefore adoptionc430b60
lines 1–58why, one step back1#!/usr/bin/env python2# -*- coding: utf-8 -*-34import sys5import unittest67from requests import async8import envoy910sys.path.append('.')11from test_requests import httpbin, RequestsTestSuite, SERVICES121314class RequestsTestSuiteUsingAsyncApi(RequestsTestSuite):15 """Requests async test cases."""1617 def patched(f):18 """Automatically send request after creation."""19 20 def wrapped(*args, **kwargs):21 22 request = f(*args, **kwargs)23 return async.map([request])[0]24 25 return wrapped2627 # Patched requests.api functions.28 global request29 request = patched(async.request)30 31 global delete, get, head, options, patch, post, put32 delete = patched(async.delete)33 get = patched(async.get)34 head = patched(async.head)35 options = patched(async.options)36 patch = patched(async.patch)37 post = patched(async.post)38 put = patched(async.put)394041 def test_entry_points(self):4243 async.request44 45 async.delete 46 async.get47 async.head48 async.options49 async.patch50 async.post51 async.put52 53 async.map54 async.send55 5657if __name__ == '__main__':58 unittest.main()