コード例 #1
0
ファイル: test_shell.py プロジェクト: th3architect/maas
 def test_upgrade_does_not_change_CalledProcessError_subclasses(self):
     error_type = factory.make_exception_type(bases=(CalledProcessError,))
     error = factory.make_CalledProcessError()
     error.__class__ = error_type  # Change the class.
     self.expectThat(error, Not(IsInstance(ExternalProcessError)))
     ExternalProcessError.upgrade(error)
     self.expectThat(error, Not(IsInstance(ExternalProcessError)))
     self.expectThat(error.__class__, Is(error_type))
コード例 #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())
     self.assertDocTestMatches(
         "Reloading BIND failed (is it running?): "
         "Command ... returned non-zero exit status ...", logger.output)
コード例 #3
0
ファイル: test_actions.py プロジェクト: sempervictus/maas
 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.assertRaises(CalledProcessError, actions.bind_reconfigure)
     self.assertDocTestMatches(
         "Reloading BIND configuration failed: "
         "Command ... returned non-zero exit status ...",
         logger.output,
     )
コード例 #4
0
ファイル: test_shell.py プロジェクト: th3architect/maas
 def test_upgrade_upgrades_CalledProcessError(self):
     error = factory.make_CalledProcessError()
     self.expectThat(error, Not(IsInstance(ExternalProcessError)))
     ExternalProcessError.upgrade(error)
     self.expectThat(error, IsInstance(ExternalProcessError))
コード例 #5
0
ファイル: test_actions.py プロジェクト: sempervictus/maas
 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())
コード例 #6
0
ファイル: test_actions.py プロジェクト: sempervictus/maas
 def test_upgrades_subprocess_error(self):
     erc = self.patch_autospec(actions, "execute_rndc_command")
     erc.side_effect = factory.make_CalledProcessError()
     self.assertRaises(ExternalProcessError, actions.bind_reconfigure)