def test_session_completion(qtmodeltester, session_manager_stub): session_manager_stub.sessions = ['default', '1', '2'] model = miscmodels.SessionCompletionModel() qtmodeltester.data_display_may_return_none = True qtmodeltester.check(model) _check_completions(model, { "Sessions": [('default', '', ''), ('1', '', ''), ('2', '', '')] })
def init_session_completion(): """Initialize session completion model.""" log.completion.debug("Initializing session completion.") try: _instances[usertypes.Completion.sessions].deleteLater() except KeyError: pass model = miscmodels.SessionCompletionModel() _instances[usertypes.Completion.sessions] = model
def test_session_completion(session_manager_stub): session_manager_stub.sessions = ['default', '1', '2'] actual = _get_completions(miscmodels.SessionCompletionModel()) assert actual == [("Sessions", [('default', '', ''), ('1', '', ''), ('2', '', '')])]