From 6d5314b74430c219c2deb34c72b6491bcb45fee3 Mon Sep 17 00:00:00 2001 From: Gayathri Rajendar Date: Fri, 28 Sep 2018 16:29:08 +0530 Subject: [PATCH] tests: Edit to expect error on report-bug association failure. Previously, on error while fetching a bug, it is returned as None and the error was not sent upstream but only logged in the server. We now expect an error instead of None on failures. Related: #710 Signed-off-by: Gayathri Rajendar --- tests/test_bugzilla.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/test_bugzilla.py b/tests/test_bugzilla.py index 59f098b60..89f7a9158 100755 --- a/tests/test_bugzilla.py +++ b/tests/test_bugzilla.py @@ -10,7 +10,7 @@ import faftests from faftests import mockzilla - +from pyfaf.common import FafError from pyfaf.bugtrackers import bugzilla from pyfaf.storage.bugtracker import Bugtracker @@ -193,35 +193,36 @@ def test_save_bug_updates_bugs(self): def test_save_bug_missing_component(self): """ - Check if download_bug_to_storage returns None + Check if download_bug_to_storage raises error if there's missing component. """ self.db.session.query(OpSysReleaseComponent).delete() self.db.session.query(OpSysComponent).delete() self.create_dummy_bug() - dbbug = self.bz.download_bug_to_storage(self.db, 1) - self.assertIsNone(dbbug) + with self.assertRaises(FafError): + self.bz.download_bug_to_storage(self.db, 1) + def test_save_bug_missing_release(self): """ - Check if download_bug_to_storage returns None + Check if download_bug_to_storage raises error if there's missing OpSysRelease. """ self.db.session.query(OpSysReleaseComponent).delete() self.db.session.query(OpSysRelease).delete() self.create_dummy_bug() - dbbug = self.bz.download_bug_to_storage(self.db, 1) - self.assertIsNone(dbbug) + with self.assertRaises(FafError): + self.bz.download_bug_to_storage(self.db, 1) def test_save_bug_missing_tracker(self): """ - Check if download_bug_to_storage returns None + Check if download_bug_to_storage raises error if tracker is not installed. """ self.db.session.query(Bugtracker).delete() self.create_dummy_bug() - dbbug = self.bz.download_bug_to_storage(self.db, 1) - self.assertIsNone(dbbug) + with self.assertRaises(FafError): + self.bz.download_bug_to_storage(self.db, 1) def test_comment_handling(self): """