pywal/tests/test_main.py

28 lines
704 B
Python
Raw Normal View History

2017-07-23 14:31:20 +02:00
"""Test __main__ functions."""
import unittest
2017-08-03 07:01:21 +02:00
from unittest.mock import MagicMock
2017-07-23 15:31:16 +02:00
2017-08-03 07:01:21 +02:00
from pywal import __main__, reload
2017-07-24 14:29:20 +02:00
from pywal.settings import CACHE_DIR
2017-07-23 14:31:20 +02:00
class TestMain(unittest.TestCase):
"""Test the gen_colors functions."""
2017-07-23 15:31:16 +02:00
def test_clean(self):
"""> Test arg parsing (-c)"""
args = __main__.get_args(["-c"])
__main__.process_args(args)
2017-07-24 14:29:20 +02:00
self.assertFalse((CACHE_DIR / "schemes").is_dir())
2017-07-23 15:31:16 +02:00
2017-08-03 07:01:21 +02:00
def test_args_e(self):
"""> Test arg parsing (-e)"""
reload.env = MagicMock()
args = __main__.get_args(["-e"])
__main__.process_args(args)
2017-08-03 07:09:03 +02:00
self.assertFalse(reload.env.called)
2017-07-23 14:33:43 +02:00
2017-07-23 14:31:20 +02:00
if __name__ == "__main__":
unittest.main()