From 258290992a5f147dec4a4f879675f047dd4eda1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20HUBSCHER?= Date: Mon, 18 Sep 2017 18:45:24 +0700 Subject: [PATCH] Fix tests. --- pollbot/tasks/__init__.py | 2 +- pollbot/tasks/product_details.py | 5 +++-- tests/test_tasks.py | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pollbot/tasks/__init__.py b/pollbot/tasks/__init__.py index 5de409c..6204214 100644 --- a/pollbot/tasks/__init__.py +++ b/pollbot/tasks/__init__.py @@ -30,8 +30,8 @@ def build_task_response(status, link, message, fail_message=None): if isinstance(status, bool): if not fail_message: fail_message = message - status = Status.EXISTS if status else Status.MISSING message = message if status else fail_message + status = Status.EXISTS if status else Status.MISSING return { "status": status.value, diff --git a/pollbot/tasks/product_details.py b/pollbot/tasks/product_details.py index 0ed6a3b..0a65f5f 100644 --- a/pollbot/tasks/product_details.py +++ b/pollbot/tasks/product_details.py @@ -39,8 +39,9 @@ async def product_details(product, version): exists_message = "We found product-details information about version {}".format( version) - missing_message = "We did not found product-details information about version".format( - version) + missing_message = ( + "We did not found product-details information about version {}".format( + version)) return build_task_response(status, url, exists_message, missing_message) diff --git a/tests/test_tasks.py b/tests/test_tasks.py index d0daac3..d8a2933 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -465,6 +465,7 @@ async def test_product_details_tasks_returns_true_if_present(self): received = await product_details('firefox', '52.0') assert received["status"] == Status.EXISTS.value + assert received["message"] == "We found product-details information about version 52.0" async def test_product_details_tasks_returns_false_if_absent(self): url = 'https://product-details.mozilla.org/1.0/firefox.json' @@ -472,6 +473,8 @@ async def test_product_details_tasks_returns_false_if_absent(self): received = await product_details('firefox', '54.0') assert received["status"] == Status.MISSING.value + assert received["message"] == ( + "We did not found product-details information about version 54.0") async def test_product_details_tasks_returns_error_if_error(self): url = 'https://product-details.mozilla.org/1.0/firefox.json'