Skip to content

Commit

Permalink
bug 1749561: add value that needs urlencoding to refine link test
Browse files Browse the repository at this point in the history
  • Loading branch information
willkg committed Jan 12, 2022
1 parent 0671fae commit 2405a25
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions webapp-django/crashstats/supersearch/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def test_search(self):
assert field.capitalize().replace("_", " ") in smart_text(response.content)

def test_search_fields(self):

user = self._login()
url = reverse("supersearch:search_fields")
response = self.client.get(url)
Expand Down Expand Up @@ -82,7 +81,7 @@ def test_search_results(self):
def mocked_supersearch_get(**params):
assert "_columns" in params

if "product" in params and "WaterWolf" in params["product"]:
if "WaterWolf" in params.get("product", []):
results = {
"hits": [
{
Expand All @@ -91,7 +90,7 @@ def mocked_supersearch_get(**params):
"uuid": "aaaaaaaaaaaaa1",
"product": "WaterWolf",
"version": "1.0",
"platform": "Linux",
"platform": "<Linux>",
"build_id": 888981,
},
{
Expand Down Expand Up @@ -136,7 +135,8 @@ def mocked_supersearch_get(**params):
results["hits"], params["_columns"]
)
return results
elif "product" in params and "SeaMonkey" in params["product"]:

elif "SeaMonkey" in params.get("product", []):
results = {
"hits": [
{
Expand Down Expand Up @@ -165,10 +165,8 @@ def mocked_supersearch_get(**params):
results["hits"], params["_columns"]
)
return results
elif (
"signature" in params
and "~nsASDOMWindowEnumerator" in params["signature"]
):

elif "~nsASDOMWindowEnumerator" in params.get("signature", []):
results = {
"hits": [
{
Expand All @@ -192,6 +190,7 @@ def mocked_supersearch_get(**params):
results["hits"], params["_columns"]
)
return results

else:
return {"hits": [], "facets": [], "total": 0}

Expand All @@ -217,8 +216,11 @@ def mocked_supersearch_get(**params):
assert "123456" in smart_text(response.content)
# Test links on terms are existing
assert "build_id=%3D888981" in smart_text(response.content)
# refine links to the product should not be "is" queries
# Refine links to the product should not be "is" queries
assert "product=WaterWolf" in smart_text(response.content)
# Refine links have values that are urlencoded (this is also a field that should
# not be an "is" query)
assert "platform=%3CLinux%3E" in smart_text(response.content)

# Test with empty results
response = self.client.get(url, {"product": "NightTrain", "date": "2012-01-01"})
Expand Down

0 comments on commit 2405a25

Please sign in to comment.