⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.234
Server IP:
13.127.59.50
Server:
Linux ip-172-31-46-210 5.15.0-1033-aws #37~20.04.1-Ubuntu SMP Fri Mar 17 11:39:30 UTC 2023 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.3-4ubuntu2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3
/
dist-packages
/
twisted
/
web
/
test
/
View File Name :
test_client.py
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for various parts of L{twisted.web}. """ from zope.interface import implementer, verify from twisted.internet import defer, interfaces from twisted.trial import unittest from twisted.web import client @implementer(interfaces.IStreamClientEndpoint) class DummyEndPoint(object): """An endpoint that does not connect anywhere""" def __init__(self, someString): self.someString = someString def __repr__(self): return 'DummyEndPoint({})'.format(self.someString) def connect(self, factory): return defer.succeed(dict(factory=factory)) class HTTPConnectionPoolTests(unittest.TestCase): """ Unit tests for L{client.HTTPConnectionPoolTest}. """ def test_implements(self): """L{DummyEndPoint}s implements L{interfaces.IStreamClientEndpoint}""" ep = DummyEndPoint("something") verify.verifyObject(interfaces.IStreamClientEndpoint, ep) def test_repr(self): """connection L{repr()} includes endpoint's L{repr()}""" pool = client.HTTPConnectionPool(reactor=None) ep = DummyEndPoint("this_is_probably_unique") d = pool.getConnection('someplace', ep) result = self.successResultOf(d) representation = repr(result) self.assertIn(repr(ep), representation)