예제 #1
0
    def test_passing_session(self):
        try:
            FuturesSession(session=requests.Session())
            assert False
        except NotImplementedError:
            pass

        sess = FuturesSession()
        try:
            sess.session = requests.Session()
            assert False
        except NotImplementedError:
            pass

        sess.session = advocate.Session()
예제 #2
0
 def test_custom_validator(self):
     validator = AddrValidator(hostname_blacklist={"example.org"})
     sess = FuturesSession(validator=validator)
     self.assertRaises(UnacceptableAddressException,
                       lambda: sess.get("http://example.org").result())
예제 #3
0
 def test_many_workers(self):
     sess = FuturesSession(max_workers=50)
     self.assertRaises(UnacceptableAddressException,
                       lambda: sess.get("http://127.0.0.1:1/").result())
예제 #4
0
 def test_get(self):
     sess = FuturesSession()
     assert 200 == sess.get("http://example.org/").result().status_code