debian-koji/tests/test_hub/test_search.py
Jana Cupova e784373000 Unify error messages
Unify error messages for CLI

Unify error messages for hub

Fixes: https://pagure.io/koji/issue/2720
2021-03-16 08:43:33 +01:00

21 lines
606 B
Python

import unittest
import koji
import kojihub
class TestSearch(unittest.TestCase):
def setUp(self):
self.exports = kojihub.RootExports()
def test_empty_terms(self):
with self.assertRaises(koji.GenericError) as cm:
self.exports.search('', 'type', 'glob')
self.assertEqual("empty search terms", str(cm.exception))
def test_wrong_type(self):
type = 'test-type'
with self.assertRaises(koji.GenericError) as cm:
self.exports.search('item', type, 'glob')
self.assertEqual("No such search type: %s" % type, str(cm.exception))