Пример #1
0
 def test_get_processed_hotkeys(self):
     hotkeys = get_processed_hotkeys([{'keys': 'f', 'link': '/test/'}])
     self.assertEquals(hotkeys, {70: {'link': '/test/'}})
     hotkeys = get_processed_hotkeys([{'keys': 'ctrl+f', 'link': '/test/'}])
     self.assertEquals(hotkeys, {17: {70: {'link': '/test/'}}})
     hotkeys = get_processed_hotkeys([{
         'keys': 'ctrl+alt+f',
         'link': '/test/'
     }])
     self.assertEquals(hotkeys, {17: {18: {70: {'link': '/test/'}}}})
     hotkeys = get_processed_hotkeys([{
         'keys': 'ctrl+alt+f',
         'link': '/test/'
     }, {
         'keys': 'ctrl+alt+d',
         'link': '/test2/'
     }])
     self.assertEquals(
         hotkeys,
         {17: {
             18: {
                 68: {
                     'link': '/test2/'
                 },
                 70: {
                     'link': '/test/'
                 }
             }
         }})
     hotkeys = get_processed_hotkeys([{
         'keys': 'ctrl+alt+shift+f',
         'link': '/test/'
     }])
     self.assertEquals(hotkeys, {})  # only three levels for now
Пример #2
0
 def test_get_processed_hotkeys(self):
     hotkeys = get_processed_hotkeys([{'keys': 'f', 'link': '/test/'}])
     self.assertEquals(hotkeys, {70: {'link': '/test/'}})
     hotkeys = get_processed_hotkeys([{'keys': 'ctrl+f', 'link': '/test/'}])
     self.assertEquals(hotkeys, {17: {70: {'link': '/test/'}}})
     hotkeys = get_processed_hotkeys([{'keys': 'ctrl+alt+f', 'link': '/test/'}])
     self.assertEquals(hotkeys, {17: {18: {70: {'link': '/test/'}}}})
     hotkeys = get_processed_hotkeys([{'keys': 'ctrl+alt+f', 'link': '/test/'},
                                     {'keys': 'ctrl+alt+d', 'link': '/test2/'}])
     self.assertEquals(hotkeys, {17: {18: {68: {'link': '/test2/'}, 70: {'link': '/test/'}}}})
     hotkeys = get_processed_hotkeys([{'keys': 'ctrl+alt+shift+f', 'link': '/test/'}])
     self.assertEquals(hotkeys, {})  # only three levels for now
Пример #3
0
def setup_hotkeys():
    """
    DSetup.
    Ex.
        {% load hotkeys %}
        {% setup_hotkeys %}
    """
    return {
        'hotkeys': get_processed_hotkeys(),
        'special_disabled': ks_settings.SPECIAL_DISABLED,
    }
Пример #4
0
 def test_get_processed_hotkeys_wrong_hotkeys(self):
     ks_settings.HOTKEYS = None
     hotkeys = get_processed_hotkeys([{'keys': 'af', 'link': '/test/'}])
     self.assertEquals(hotkeys, dict())
     hotkeys = get_processed_hotkeys([{'keys': '(', 'link': '/test/'}])
     self.assertEquals(hotkeys, dict())
Пример #5
0
 def test_get_processed_hotkeys_no_hotkeys(self):
     ks_settings.HOTKEYS = None
     hotkeys = get_processed_hotkeys()
     self.assertEquals(hotkeys, dict())
Пример #6
0
 def test_get_processed_hotkeys_from_ks_settings(self):
     hotkeys = get_processed_hotkeys([{'keys': 'f', 'link': '/test/'}])
     hotkeys_from_ks_settings = get_processed_hotkeys()
     self.assertEquals(hotkeys, hotkeys_from_ks_settings)
Пример #7
0
 def test_get_processed_hotkeys_wrong_hotkeys(self):
     ks_settings.HOTKEYS = None
     hotkeys = get_processed_hotkeys([{'keys': 'af', 'link': '/test/'}])
     self.assertEquals(hotkeys, dict())
     hotkeys = get_processed_hotkeys([{'keys': '(', 'link': '/test/'}])
     self.assertEquals(hotkeys, dict())
Пример #8
0
 def test_get_processed_hotkeys_no_hotkeys(self):
     ks_settings.HOTKEYS = None
     hotkeys = get_processed_hotkeys()
     self.assertEquals(hotkeys, dict())
Пример #9
0
 def test_get_processed_hotkeys_from_ks_settings(self):
     hotkeys = get_processed_hotkeys([{'keys': 'f', 'link': '/test/'}])
     hotkeys_from_ks_settings = get_processed_hotkeys()
     self.assertEquals(hotkeys, hotkeys_from_ks_settings)