From 94708024da3e5db16dd67ad3582b111f705b1d89 Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 11 Jan 2021 14:29:02 -0500 Subject: [PATCH] Fixed unit test for fortune plugin --- tests/test_plugin.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 1ec2622..3be42f0 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -26,15 +26,13 @@ class TestPlugin(unittest.TestCase): actual = fortune.run(self.fromcall, message, self.ack) self.assertEqual(expected, actual) - @mock.patch("subprocess.Popen") + @mock.patch("subprocess.check_output") @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) mock_which.return_value = "/usr/bin/games" - mock_process = mock.MagicMock() - mock_process.communicate.return_value = [b"Funny fortune"] - mock_popen.return_value = mock_process + mock_output.return_value = "Funny fortune" message = "fortune" expected = "Funny fortune"