pywal/tests/test_main.py

31 lines
741 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
import os
2017-08-03 07:10:42 +02:00
from pywal import __main__
from pywal import 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)
self.assertFalse(os.path.isdir(str(CACHE_DIR / "schemes")))
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()