mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-02-03 12:00:21 +01:00
tests: Added test for msg()
This commit is contained in:
parent
a38115407c
commit
64e0ca26f1
@ -1,5 +1,7 @@
|
||||
"""Test util functions."""
|
||||
import unittest
|
||||
import unittest.mock
|
||||
import io
|
||||
import os
|
||||
import pathlib
|
||||
import time
|
||||
@ -95,6 +97,14 @@ class TestUtil(unittest.TestCase):
|
||||
self.assertTrue(result)
|
||||
os.remove(test_file)
|
||||
|
||||
def test_msg(self):
|
||||
"""> Test displaying a message."""
|
||||
# Since this function just prints a message we redirect
|
||||
# it's output so that we can read it.
|
||||
with unittest.mock.patch('sys.stdout', new=io.StringIO()) as fake_out:
|
||||
util.msg("test", True)
|
||||
self.assertEqual(fake_out.getvalue().strip(), "test")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user