Allow setting mock keybindings for unit tests.

Implement mock_key_config.set_bindings_for to set bindings that will be
retrieved by mock_key_config.get_bindings_for.
This is useful for testing the new keyhint ui.
This commit is contained in:
Ryan Roden-Corrent 2016-05-15 22:18:16 -04:00
parent d506d7793f
commit 581a521b4d

View File

@ -385,8 +385,14 @@ class KeyConfigStub:
"""Stub for the key-config object."""
def get_bindings_for(self, _section):
return {}
def __init__(self):
self.bindings = {}
def get_bindings_for(self, section):
return self.bindings.get(section)
def set_bindings_for(self, section, bindings):
self.bindings[section] = bindings
class HostBlockerStub: