Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P7142
MemoryReactor example
Active
Public
Actions
Authored by
Vgutierrez
on May 21 2018, 4:04 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F18425561: MemoryReactor example
May 21 2018, 4:04 PM
2018-05-21 16:04:30 (UTC+0)
Subscribers
None
@mock.patch
(
'pybal.monitors.proxyfetch.reactor'
,
new_callable
=
twisted
.
test
.
proto_helpers
.
MemoryReactor
)
def
testGetProxyPageHTTP
(
self
,
mock_reactor
):
testURL
=
"http://en.wikipedia.org/"
host
=
"cp1001.eqiad.wmnet"
port
=
80
r
=
ProxyFetchMonitoringProtocol
.
getProxyPage
(
testURL
,
host
=
host
,
port
=
port
)
self
.
assertIsInstance
(
r
,
defer
.
Deferred
)
self
.
assertTrue
(
len
(
pybal
.
monitors
.
proxyfetch
.
reactor
.
tcpClients
)
==
1
)
self
.
assertEqual
(
pybal
.
monitors
.
proxyfetch
.
reactor
.
tcpClients
[
-
1
][
0
],
host
)
self
.
assertEqual
(
pybal
.
monitors
.
proxyfetch
.
reactor
.
tcpClients
[
-
1
][
1
],
port
)
self
.
assertIsInstance
(
pybal
.
monitors
.
proxyfetch
.
reactor
.
tcpClients
[
-
1
][
2
],
twisted
.
web
.
client
.
HTTPClientFactory
)
self
.
assertEqual
(
pybal
.
monitors
.
proxyfetch
.
reactor
.
tcpClients
[
-
1
][
2
]
.
url
,
testURL
)
Event Timeline
Vgutierrez
created this paste.
May 21 2018, 4:04 PM
2018-05-21 16:04:30 (UTC+0)
Log In to Comment