mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 00:35:50 +02:00
* Addressing #4071 Wrote an ImmutableReturnMixin to prevent developers overriding return_value in certain Mock objects * Language * Loosening the assumption that underlying _mock objects need to be Immutable-like simplifies implementation * Addressing #4071 * Ensure side_effects and return_values are pushed down to the underlying _mock in FreezableMocks. And IDisplay mocks are no longer frozen in _create_get_utility_mock() * Edit a handful of tests to not override the mock_get_utility return_value * Brief explainer of FreezableMock.__setattr__ * Incorporating PR feedback and some compatibility * FreezableMock __getattr__ needs a shortcut in case of return_value or side_effect * Changing return_value only forbidden if set before freezing * Remove unnecessary else block * Expanded doc strings * Bring a couple new tests in line with patch_get_utility() norms
This commit is contained in:
committed by
Brad Warren
parent
ae0be73b53
commit
2bfc92e58d
@@ -158,10 +158,11 @@ class AuthenticatorTest(unittest.TestCase):
|
||||
|
||||
@test_util.patch_get_utility()
|
||||
def test_perform_eaddrinuse_retry(self, mock_get_utility):
|
||||
mock_utility = mock_get_utility()
|
||||
errno = socket.errno.EADDRINUSE
|
||||
error = errors.StandaloneBindError(mock.MagicMock(errno=errno), -1)
|
||||
self.auth.servers.run.side_effect = [error] + 2 * [mock.MagicMock()]
|
||||
mock_yesno = mock_get_utility.return_value.yesno
|
||||
mock_yesno = mock_utility.yesno
|
||||
mock_yesno.return_value = True
|
||||
|
||||
self.test_perform()
|
||||
@@ -169,7 +170,8 @@ class AuthenticatorTest(unittest.TestCase):
|
||||
|
||||
@test_util.patch_get_utility()
|
||||
def test_perform_eaddrinuse_no_retry(self, mock_get_utility):
|
||||
mock_yesno = mock_get_utility.return_value.yesno
|
||||
mock_utility = mock_get_utility()
|
||||
mock_yesno = mock_utility.yesno
|
||||
mock_yesno.return_value = False
|
||||
|
||||
errno = socket.errno.EADDRINUSE
|
||||
|
||||
Reference in New Issue
Block a user