diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-07-23 21:09:02 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-07-23 21:09:02 +1000 |
| commit | caacba6e15bcf6117fec853e388696d7edd0c312 (patch) | |
| tree | 708ed23d6771cc77d31a60a78767fb858cbd1b26 /tests | |
| parent | 78118d396567711442abb8f8bfaa07c0e1f8478f (diff) | |
tests: Test image cache
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/test_colors.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_colors.py b/tests/test_colors.py index 4e471c3..506bbc9 100755 --- a/tests/test_colors.py +++ b/tests/test_colors.py @@ -1,5 +1,7 @@ """Test imagemagick functions.""" import unittest +import unittest.mock +import io from pywal import colors @@ -17,6 +19,15 @@ class TestGenColors(unittest.TestCase): with self.assertRaises(SystemExit): 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__": unittest.main() |
