From 581a521b4d269dcbd81c2e15514c5048b15ead98 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sun, 15 May 2016 22:18:16 -0400 Subject: [PATCH] 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. --- tests/helpers/stubs.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index f414fba74..adaebd168 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -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: