mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-06-13 21:27:08 +02:00
tests: Test image cache
This commit is contained in:
parent
78118d3965
commit
caacba6e15
@ -1,5 +1,7 @@
|
|||||||
"""Test imagemagick functions."""
|
"""Test imagemagick functions."""
|
||||||
import unittest
|
import unittest
|
||||||
|
import unittest.mock
|
||||||
|
import io
|
||||||
|
|
||||||
from pywal import colors
|
from pywal import colors
|
||||||
|
|
||||||
@ -17,6 +19,15 @@ class TestGenColors(unittest.TestCase):
|
|||||||
with self.assertRaises(SystemExit):
|
with self.assertRaises(SystemExit):
|
||||||
colors.get("tests/test_files/test.png")
|
colors.get("tests/test_files/test.png")
|
||||||
|
|
||||||
|
def test_color_cache(self):
|
||||||
|
"""> Test importing a cached scheme."""
|
||||||
|
# Since this function just prints a message we redirect
|
||||||
|
# it's output so that we can read it.
|
||||||
|
message = "colors: Found cached colorscheme."
|
||||||
|
with unittest.mock.patch('sys.stdout', new=io.StringIO()) as fake_out:
|
||||||
|
colors.get("tests/test_files/test.jpg")
|
||||||
|
self.assertEqual(fake_out.getvalue().strip(), message)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user