bumblebee-status/tests/core/test_output.py
Tobias Witek 66537fbe05 [core/output] Rewrite to hide sys.stout
Add generic "draw()" method that redirects internally to the actual
calls. These can now produce JSON, which is nicer because:

1. Easier to use during testing
2. More flexible
3. Centralizes printing (somewhat)

Still, the "suffix" concept isn't really nice, but so far, I have no
better approach.
2020-02-01 21:37:38 +01:00

25 lines
651 B
Python

import unittest
import json
import core.output
class i3(unittest.TestCase):
def setUp(self):
self.i3 = core.output.i3()
def tearDown(self):
pass
def test_start(self):
all_data = self.i3.start()
data = all_data['data']
self.assertEqual(1, data['version'], 'i3bar protocol version 1 expected')
self.assertTrue(data['click_events'], 'click events should be enabled')
self.assertEqual('\n[', all_data['suffix'])
def test_stop(self):
self.assertEqual('\n]', self.i3.stop()['suffix'])
# TODO: mock a "draw" call
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4