Fix basekeyparser tests.

This commit is contained in:
Florian Bruhin 2014-09-28 22:24:49 +02:00
parent dc7b32e460
commit 7e017e66a0

View File

@ -67,7 +67,7 @@ class SplitCountTests(unittest.TestCase):
""" """
def setUp(self): def setUp(self):
self.kp = basekeyparser.BaseKeyParser(supports_count=True) self.kp = basekeyparser.BaseKeyParser(0, supports_count=True)
def test_onlycount(self): def test_onlycount(self):
"""Test split_count with only a count.""" """Test split_count with only a count."""
@ -114,13 +114,13 @@ class ReadConfigTests(unittest.TestCase):
def test_read_config_invalid(self): def test_read_config_invalid(self):
"""Test reading config without setting it before.""" """Test reading config without setting it before."""
kp = basekeyparser.BaseKeyParser() kp = basekeyparser.BaseKeyParser(0)
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
kp.read_config() kp.read_config()
def test_read_config_valid(self): def test_read_config_valid(self):
"""Test reading config.""" """Test reading config."""
kp = basekeyparser.BaseKeyParser(supports_count=True, kp = basekeyparser.BaseKeyParser(0, supports_count=True,
supports_chains=True) supports_chains=True)
kp.read_config('test') kp.read_config('test')
self.assertIn('ccc', kp.bindings) self.assertIn('ccc', kp.bindings)
@ -147,7 +147,7 @@ class SpecialKeysTests(unittest.TestCase):
patcher.start() patcher.start()
objreg.register('key-config', fake_keyconfig) objreg.register('key-config', fake_keyconfig)
self.addCleanup(patcher.stop) self.addCleanup(patcher.stop)
self.kp = basekeyparser.BaseKeyParser() self.kp = basekeyparser.BaseKeyParser(0)
self.kp.execute = mock.Mock() self.kp.execute = mock.Mock()
self.kp.read_config('test') self.kp.read_config('test')
@ -187,7 +187,7 @@ class KeyChainTests(unittest.TestCase):
objreg.register('key-config', fake_keyconfig) objreg.register('key-config', fake_keyconfig)
self.timermock = mock.Mock() self.timermock = mock.Mock()
basekeyparser.usertypes.Timer = mock.Mock(return_value=self.timermock) basekeyparser.usertypes.Timer = mock.Mock(return_value=self.timermock)
self.kp = basekeyparser.BaseKeyParser(supports_chains=True, self.kp = basekeyparser.BaseKeyParser(0, supports_chains=True,
supports_count=False) supports_count=False)
self.kp.execute = mock.Mock() self.kp.execute = mock.Mock()
self.kp.read_config('test') self.kp.read_config('test')
@ -254,7 +254,7 @@ class CountTests(unittest.TestCase):
def setUp(self): def setUp(self):
objreg.register('key-config', fake_keyconfig) objreg.register('key-config', fake_keyconfig)
basekeyparser.usertypes.Timer = mock.Mock() basekeyparser.usertypes.Timer = mock.Mock()
self.kp = basekeyparser.BaseKeyParser(supports_chains=True, self.kp = basekeyparser.BaseKeyParser(0, supports_chains=True,
supports_count=True) supports_count=True)
self.kp.execute = mock.Mock() self.kp.execute = mock.Mock()
self.kp.read_config('test') self.kp.read_config('test')