mirror of
https://github.com/craigerl/aprsd.git
synced 2025-09-05 06:37:53 -04:00
Fixed unit test for fortune plugin
This commit is contained in:
parent
7ab26135c2
commit
94708024da
@ -26,15 +26,13 @@ class TestPlugin(unittest.TestCase):
|
|||||||
actual = fortune.run(self.fromcall, message, self.ack)
|
actual = fortune.run(self.fromcall, message, self.ack)
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
@mock.patch("subprocess.Popen")
|
@mock.patch("subprocess.check_output")
|
||||||
@mock.patch("shutil.which")
|
@mock.patch("shutil.which")
|
||||||
def test_fortune_success(self, mock_which, mock_popen):
|
def test_fortune_success(self, mock_which, mock_output):
|
||||||
fortune = fortune_plugin.FortunePlugin(self.config)
|
fortune = fortune_plugin.FortunePlugin(self.config)
|
||||||
mock_which.return_value = "/usr/bin/games"
|
mock_which.return_value = "/usr/bin/games"
|
||||||
|
|
||||||
mock_process = mock.MagicMock()
|
mock_output.return_value = "Funny fortune"
|
||||||
mock_process.communicate.return_value = [b"Funny fortune"]
|
|
||||||
mock_popen.return_value = mock_process
|
|
||||||
|
|
||||||
message = "fortune"
|
message = "fortune"
|
||||||
expected = "Funny fortune"
|
expected = "Funny fortune"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user