debian-koji/tests/test_hub/test_get_build_notification.py
Tomas Kopecek e6e618d0bb fix tests
2022-12-08 13:37:32 +01:00

22 lines
698 B
Python

import mock
import unittest
import koji
import kojihub
class TestGetBuildNotification(unittest.TestCase):
def setUp(self):
self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()
self.query = self.QueryProcessor.return_value
self.exports = kojihub.RootExports()
def tearDown(self):
mock.patch.stopall()
def test_empty_result_with_strict(self):
notif_id = 1
self.query.executeOne.return_value = None
with self.assertRaises(koji.GenericError) as cm:
self.exports.getBuildNotification(notif_id, strict=True)
self.assertEqual(f"No notification with ID {notif_id} found", str(cm.exception))