Skip to content

Commit

Permalink
Bug 1091579 - Combine the tests for correct and incorrect search terms
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Morley committed Oct 30, 2014
1 parent 8b803b1 commit 6cb4526
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions tests/model/derived/test_refdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,15 @@ def test_update_bugscache(refdata, sample_bugs):
"test_popup_preventdefault_chrome.xul",
[455091]
),
(
"test_popup_preventdefault_chrome.xul foo bar",
[]
),
)


@pytest.mark.parametrize(("search_term", "exp_bugs"), SEARCH_TERMS)
def test_get_open_recent_bug_right_term(refdata, sample_bugs, search_term, exp_bugs):
def test_get_open_recent_bugs(refdata, sample_bugs, search_term, exp_bugs):
"""Test that we retrieve the expected open recent bugs for a search term."""
bug_list = sample_bugs['bugs']
fifty_days_ago = datetime.now() - timedelta(days=50)
Expand All @@ -476,26 +480,6 @@ def test_get_open_recent_bug_right_term(refdata, sample_bugs, search_term, exp_b
assert len(suggestions['all_others']) == 0


def test_get_open_recent_bug_wrong_term(refdata, sample_bugs):
"""Test that we don't retrieve any recent bugs given the wrong search term."""
search_term = "test_popup_preventdefault_chrome.xul foo bar"

bug_list = sample_bugs['bugs']

fifty_days_ago = datetime.now() - timedelta(days=50)
# update the last_change date so that they will be
# placed in the open_recent bucket
for bug in bug_list:
bug['last_change_time'] = fifty_days_ago
refdata.update_bugscache(bug_list)

suggestions = refdata.get_bug_suggestions(search_term)
# we don't have any open recent bugs suggested
assert len(suggestions['open_recent']) == 0
# we don't have any old bugs suggested
assert len(suggestions['all_others']) == 0


def test_get_all_other_bugs_right_term(refdata, sample_bugs):
"""Test that we can retrieve old bugs given the right search term."""
search_term = "test_popup_preventdefault_chrome.xul"
Expand Down

0 comments on commit 6cb4526

Please sign in to comment.