Example #1
0
 def test_executes_rndc_command(self):
     self.patch_autospec(actions, "execute_rndc_command")
     self.assertTrue(actions.bind_reload_zones(sentinel.zone))
     self.assertThat(
         actions.execute_rndc_command,
         MockCalledOnceWith(("reload", sentinel.zone)),
     )
Example #2
0
 def test__logs_subprocess_error(self):
     erc = self.patch_autospec(actions, "execute_rndc_command")
     erc.side_effect = factory.make_CalledProcessError()
     with FakeLogger("maas") as logger:
         self.assertFalse(actions.bind_reload_zones(sentinel.zone))
     self.assertDocTestMatches(
         "Reloading BIND zone ... failed (is it running?): "
         "Command ... returned non-zero exit status ...", logger.output)
Example #3
0
 def test_false_on_subprocess_error(self):
     erc = self.patch_autospec(actions, "execute_rndc_command")
     erc.side_effect = factory.make_CalledProcessError()
     self.assertFalse(actions.bind_reload_zones(sentinel.zone))