mirror of
https://github.com/certbot/certbot.git
synced 2026-06-13 10:40:10 -04:00
Improve obtain_cert no pause test
This commit is contained in:
parent
36a520ed0c
commit
1ceea35669
1 changed files with 14 additions and 1 deletions
|
|
@ -13,6 +13,14 @@ from certbot.plugins import disco as plugins_disco
|
|||
class ObtainCertTest(unittest.TestCase):
|
||||
"""Tests for certbot.main.obtain_cert."""
|
||||
|
||||
def setUp(self):
|
||||
self.get_utility_patch = mock.patch(
|
||||
'certbot.main.zope.component.getUtility')
|
||||
self.mock_get_utility = self.get_utility_patch.start()
|
||||
|
||||
def tearDown(self):
|
||||
self.get_utility_patch.stop()
|
||||
|
||||
def _call(self, args):
|
||||
plugins = plugins_disco.PluginsRegistry.find_all()
|
||||
config = configuration.NamespaceConfig(
|
||||
|
|
@ -26,10 +34,15 @@ class ObtainCertTest(unittest.TestCase):
|
|||
|
||||
@mock.patch('certbot.main._auth_from_domains')
|
||||
def test_no_reinstall_text_pause(self, mock_auth):
|
||||
mock_notification = self.mock_get_utility().notification
|
||||
mock_notification.side_effect = self._assert_no_pause
|
||||
mock_auth.return_value = (mock.ANY, 'reinstall')
|
||||
# This hangs if the reinstallation notification pauses
|
||||
self._call('certonly --webroot -d example.com -t'.split())
|
||||
|
||||
def _assert_no_pause(self, message, height=42, pause=True):
|
||||
# pylint: disable=unused-argument
|
||||
self.assertFalse(pause)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main() # pragma: no cover
|
||||
|
|
|
|||
Loading…
Reference in a new issue