def test_are_requested(self):
     self.assertEqual(
         len([i for i in enhancements.enabled_enhancements(self.config)]), 0)
     self.assertFalse(enhancements.are_requested(self.config))
     self.config.auto_hsts = True
     self.assertEqual(
         len([i for i in enhancements.enabled_enhancements(self.config)]), 1)
     self.assertTrue(enhancements.are_requested(self.config))
Beispiel #2
0
 def test_are_requested(self):
     self.assertEqual(
         len([i for i in enhancements.enabled_enhancements(self.config)]), 0)
     self.assertFalse(enhancements.are_requested(self.config))
     self.config.auto_hsts = True
     self.assertEqual(
         len([i for i in enhancements.enabled_enhancements(self.config)]), 1)
     self.assertTrue(enhancements.are_requested(self.config))
Beispiel #3
0
 def test_enhancement_enabled_enhancements(self, _):
     FAKEINDEX = [{
         "name": "autohsts",
         "cli_dest": "auto_hsts",
     }, {
         "name": "somethingelse",
         "cli_dest": "something",
     }]
     with mock.patch("certbot.plugins.enhancements._INDEX", FAKEINDEX):
         self.config.auto_hsts = True
         self.config.something = True
         enabled = list(enhancements.enabled_enhancements(self.config))
     self.assertEqual(len(enabled), 2)
     self.assertTrue([i for i in enabled if i["name"] == "autohsts"])
     self.assertTrue([i for i in enabled if i["name"] == "somethingelse"])
 def test_enhancement_enabled_enhancements(self, _):
     FAKEINDEX = [
         {
             "name": "autohsts",
             "cli_dest": "auto_hsts",
         },
         {
             "name": "somethingelse",
             "cli_dest": "something",
         }
     ]
     with mock.patch("certbot.plugins.enhancements._INDEX", FAKEINDEX):
         self.config.auto_hsts = True
         self.config.something = True
         enabled = list(enhancements.enabled_enhancements(self.config))
     self.assertEqual(len(enabled), 2)
     self.assertTrue([i for i in enabled if i["name"] == "autohsts"])
     self.assertTrue([i for i in enabled if i["name"] == "somethingelse"])