def test_ctrl_with_no_tag_matches(note_model, model_type): with pytest.raises(SystemExit): ctrl = Controller(model_type) ctrl.model = note_model if model_type == 'tags': ctrl.model = TagsModel(note_model) ctrl.service_rules = ServiceRules(ctrl.model) ctrl.query_output('no_matching_tag')
def test_ctrl_basic_out(note_model, model_type, expected): expected['tab_title'] = 'general' with patch('foolscap.note_display.display_list') as _mock: ctrl = Controller(model_type) ctrl.model = note_model expected['model'] = note_model if model_type == 'tags': ctrl.model = TagsModel(note_model) expected['model'] = ctrl.model ctrl.service_rules = ServiceRules(ctrl.model) ctrl.basic_output('general') _mock.assert_called_with(expected)
def test_ctrl_query_out(note_model, model_type, query, expected): expected['tab_title'] = "tag: '{}'".format(query) with patch('foolscap.note_display.display_list') as _mock: ctrl = Controller(model_type) ctrl.model = note_model expected['model'] = note_model if model_type == 'tags': ctrl.model = TagsModel(note_model) expected['model'] = ctrl.model ctrl.service_rules = ServiceRules(ctrl.model) ctrl.query_output(query) _mock.assert_called_with(expected)
def test_search_notes(note_model, model_type, query, expected): expected['books'] = ['general'] * 7 expected['tab_title'] = 'search' with patch('foolscap.note_display.display_list') as _mock: ctrl = Controller(model_type) ctrl.model = note_model expected['model'] = note_model if model_type == 'tags': ctrl.model = TagsModel(note_model) expected['model'] = ctrl.model ctrl.service_rules = ServiceRules(ctrl.model) ctrl.search_output(query) _mock.assert_called_with(expected)