mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
Add a specific must-staple test
This commit is contained in:
parent
5a3397cf63
commit
efcd0090da
1 changed files with 19 additions and 0 deletions
|
|
@ -304,6 +304,25 @@ class ClientTest(unittest.TestCase):
|
|||
installer.rollback_checkpoints.assert_called_once_with()
|
||||
self.assertEqual(installer.restart.call_count, 1)
|
||||
|
||||
@mock.patch("certbot.client.enhancements")
|
||||
def test_must_staple(self, mock_enhancements):
|
||||
# Testing our wanted behaviour: Enable OCSP Stapling when the
|
||||
# --must-staple flag is on. [Without having the --staple-ocsp flag on]
|
||||
config = ConfigHelper(must_staple=True, staple=False)
|
||||
self.assertRaises(errors.Error,
|
||||
self.client.enhance_config, ["foo.bar"], config)
|
||||
|
||||
mock_enhancements.ask.return_value = True
|
||||
installer = mock.MagicMock()
|
||||
self.client.installer = installer
|
||||
installer.supported_enhancements.return_value = ["staple-ocsp"]
|
||||
|
||||
self.client.enhance_config(["foo.bar"], config)
|
||||
installer.enhance.assert_called_once_with("foo.bar", "staple-ocsp", None)
|
||||
self.assertEqual(installer.save.call_count, 1)
|
||||
installer.restart.assert_called_once_with()
|
||||
|
||||
|
||||
@mock.patch("certbot.client.enhancements")
|
||||
def test_enhance_config(self, mock_enhancements):
|
||||
config = ConfigHelper(redirect=True, hsts=False, uir=False, must_staple=False)
|
||||
|
|
|
|||
Loading…
Reference in a new issue