Skip to content

Commit

Permalink
tests: Edit to expect error on report-bug association failure.
Browse files Browse the repository at this point in the history
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 <gayathriirajendar@gmail.com>
  • Loading branch information
gayathrirajendar authored and mkutlak committed Oct 2, 2018
1 parent 9fa9383 commit 6d5314b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tests/test_bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit 6d5314b

Please sign in to comment.