Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import unittest
2from unittest import mock
3from pi3bar.plugins.uname import Uname
6@mock.patch('pi3bar.plugins.uname.subprocess.check_output')
7class UnameTestCase(unittest.TestCase):
8 def test(self, mock_check_output):
9 plugin = Uname()
11 self.assertEqual('r', plugin.full_param)
12 self.assertEqual('r', plugin.short_param)
13 self.assertEqual('r', plugin.instance)
14 call = mock.call(['uname', '-r'])
15 mock_check_output.assert_has_calls([call, call], any_order=True)
17 def test_different_params(self, mock_check_output):
18 plugin = Uname(full_param='a', short_param='s')
20 self.assertEqual('a', plugin.full_param)
21 self.assertEqual('s', plugin.short_param)
22 self.assertEqual('a', plugin.instance)
23 mock_check_output.assert_has_calls(
24 [
25 mock.call(['uname', '-a']),
26 mock.call(['uname', '-s']),
27 ], any_order=True
28 )
30 def test_text(self, mock_check_output):
31 mock_check_output.return_value = b'xyz '
32 plugin = Uname()
34 self.assertEqual('xyz', plugin.full_text)
35 self.assertEqual('xyz', plugin.short_text)