diff --git a/setup.py b/setup.py index 5959e3b..1ccbcea 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ with open('README.md', encoding='utf-8') as f: long_description = f.read() tests_require = [ - 'pytest-cov', 'hypothesis>=3.7.0', 'pytest>=3.4.0', 'py>=1.5.0', + 'pytest-cov', 'hypothesis>=3.7.0', 'pytest==3.4.2', 'py>=1.5.0', 'beautifulsoup4==4.6.0', 'flake8>=3.4.1', 'pylint>=1.7.2' ], diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py index c1c514f..7856b05 100644 --- a/tests/test_bukuDb.py +++ b/tests/test_bukuDb.py @@ -1309,6 +1309,27 @@ def test_load_firefox_database(firefox_db, add_pt): assert call_args_list_dict == res_pickle +@pytest.mark.parametrize( + 'keyword_results, stag_results, exp_res', + [ + ([], [], []), + (['item1'], ['item1', 'item2'], ['item1']), + (['item2'], ['item1'], []), + ] +) +def test_search_keywords_and_filter_by_tags(keyword_results, stag_results, exp_res): + """test method.""" + # init + import buku + bdb = buku.BukuDb() + bdb.searchdb = mock.Mock(return_value=keyword_results) + bdb.search_by_tag = mock.Mock(return_value=stag_results) + # test + res = bdb.search_keywords_and_filter_by_tags( + mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), []) + assert exp_res == res + + # Helper functions for testcases