def test_reset_no_response_get(self, mock_time, mock_requests, mock_get_url):
"""
Given: Mock requests configured to raise requests.exceptions.ConnectTimeout on get.
and: EzOutlet initialized with an IP address and timeout.
When: Calling reset(post_reset_delay, ez_outlet_reset_interval).
Then: ez_outlet._get_url is called using the IP address with ez_outlet.RESET_URL_PATH.
and: requests.get(ez_outlet._get_url's result, timeout, proxies=PROXY_SETTINGS_NONE) is called.
"""
_ = mock_time
# Given
self.configure_mock_requests(mock_requests=mock_requests)
# When
try:
self.uut.reset(post_reset_delay=self.post_reset_delay,
ez_outlet_reset_interval=self.ez_outlet_reset_interval)
except ezoutlet.exceptions.EzOutletError:
pass # exception tested elsewhere
# Then
mock_get_url.assert_called_with(self.hostname, ez_outlet.EzOutlet.RESET_URL_PATH)
mock_requests.get.assert_called_once_with(sample_url, timeout=self.timeout, proxies=PROXY_SETTINGS_NONE)
评论列表
文章目录