mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-23 06:18:35 +01:00
tests: Add more tests
This commit is contained in:
parent
2da36f38ac
commit
c68057ec48
@ -1,28 +1,43 @@
|
|||||||
"""Test __main__ functions."""
|
"""Test __main__ functions."""
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import MagicMock
|
import unittest.mock
|
||||||
|
|
||||||
from pywal import __main__
|
from pywal import __main__
|
||||||
from pywal import reload
|
from pywal import reload
|
||||||
|
from pywal import wallpaper
|
||||||
|
from pywal import util
|
||||||
from pywal.settings import CACHE_DIR
|
from pywal.settings import CACHE_DIR
|
||||||
|
|
||||||
|
|
||||||
class TestMain(unittest.TestCase):
|
class TestMain(unittest.TestCase):
|
||||||
"""Test the gen_colors functions."""
|
"""Test the gen_colors functions."""
|
||||||
|
|
||||||
def test_clean(self):
|
def test_args_a(self):
|
||||||
"""> Test arg parsing (-c)"""
|
"""> Test arg parsing (-a)."""
|
||||||
|
args = __main__.get_args(["-a", "50"])
|
||||||
|
__main__.process_args(args)
|
||||||
|
self.assertEqual(util.Color.alpha_num, "50")
|
||||||
|
|
||||||
|
def test_args_c(self):
|
||||||
|
"""> Test arg parsing (-c)."""
|
||||||
args = __main__.get_args(["-c"])
|
args = __main__.get_args(["-c"])
|
||||||
__main__.process_args(args)
|
__main__.process_args(args)
|
||||||
self.assertFalse((CACHE_DIR / "schemes").is_dir())
|
self.assertFalse((CACHE_DIR / "schemes").is_dir())
|
||||||
|
|
||||||
def test_args_e(self):
|
def test_args_e(self):
|
||||||
"""> Test arg parsing (-e)"""
|
"""> Test arg parsing (-e)."""
|
||||||
reload.env = MagicMock()
|
reload.env = unittest.mock.MagicMock()
|
||||||
args = __main__.get_args(["-e"])
|
args = __main__.get_args(["-e"])
|
||||||
__main__.process_args(args)
|
__main__.process_args(args)
|
||||||
self.assertFalse(reload.env.called)
|
self.assertFalse(reload.env.called)
|
||||||
|
|
||||||
|
def test_args_n(self):
|
||||||
|
"""> Test arg parsing (-n)."""
|
||||||
|
wallpaper.change = unittest.mock.MagicMock()
|
||||||
|
args = __main__.get_args(["-n"])
|
||||||
|
__main__.process_args(args)
|
||||||
|
self.assertFalse(wallpaper.change.called)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user