def test_hotkey_get(self): rv = dbapi.hotkey_get(self.db, self.profile, self.book) assert not rv dbapi.hotkey_create(self.db, self.profile, self.book, self.hotkey) rv = dbapi.hotkey_get(self.db, self.profile, self.book) assert rv == self.hotkey
def test_all_other_runs_with_profile_active(s): s.first_run = False dbapi.profile_create(s.app.db, s.profile) dbapi.hotkey_create(s.app.db, 'default', s.book, s.hotkey) dbapi.hotkey_create(s.app.db, s.profile, s.book, s.hotkey) response = s.run(req.ui_init, s.app, s.first_run) assert response[1]['output_method'] == 'system_hotkey_register'
def test_hotkeys_reload(s): response = s.run(req.hotkeys_reload, s.app, 'default', s.profile) assert not response dbapi.profile_create(s.app.db, s.profile) dbapi.hotkey_create(s.app.db, 'default', s.book, s.hotkey) dbapi.hotkey_create(s.app.db, s.profile, s.book, s.hotkey) response = s.run(req.hotkeys_reload, s.app, 'default', s.profile) assert response[0]['output_method'] == 'system_hotkey_unregister' assert response[1]['output_method'] == 'system_hotkey_register'
def test_hotkey_delete(self): rv = dbapi.hotkey_delete(self.db, self.profile, self.book, self.hotkey) assert not rv dbapi.hotkey_create(self.db, self.profile, self.book, self.hotkey) rv = dbapi.hotkey_delete(self.db, self.profile, self.book, self.hotkey) assert rv data = get_all_data(self.db, 'Hotkeys') assert not data
def test_hotkey_create(self): rv = dbapi.hotkey_create(self.db, self.profile, self.book, self.hotkey) assert rv data = get_all_data(self.db, 'Hotkeys')[0] assert data[0] == self.profile assert data[1] == self.book assert data[2] == json.dumps(self.hotkey) rv = dbapi.hotkey_create(self.db, self.profile, self.book, self.hotkey) assert not rv
def test_hotkey_load_all(s): response = s.run(req.hotkeys_load_all, s.app, s.profile) assert not response dbapi.profile_create(s.app.db, s.profile) response = s.run(req.hotkeys_load_all, s.app, s.profile) assert not response dbapi.hotkey_create(s.app.db, s.profile, s.book, s.hotkey) hotkey2 = ['f11'] dbapi.hotkey_create(s.app.db, s.profile, s.book, hotkey2) response = s.run(req.hotkeys_load_all, s.app, s.profile) assert response[0]['output_method'] == 'system_hotkey_register' assert response[0]['output_kwargs']['hotkey'] in (s.hotkey, hotkey2) assert response[1]['output_method'] == 'system_hotkey_register' assert response[1]['output_kwargs']['hotkey'] in (s.hotkey, hotkey2)
def hotkey_create(app, profile, book, hotkey): if dbapi.hotkey_create(app.db, profile, book, hotkey): yield resp.noop(key='hotkey_created') else: yield resp.noop(key='hotkey_taken')