From: Markus Lehtonen Date: Fri, 30 May 2014 10:36:24 +0000 (+0300) Subject: tests: test case for internal service errors X-Git-Tag: submit/devel/20190730.075437~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ddd8d7e4a24953ac490cd08d01e9527264b81464;p=services%2Fobs-service-git-buildpackage.git tests: test case for internal service errors Change-Id: If52270d8375e3cb2fc4f4198c7a1bdab782651f4 Signed-off-by: Markus Lehtonen --- diff --git a/tests/test_obs_service_gbp.py b/tests/test_obs_service_gbp.py index 63f3e5a..a722284 100644 --- a/tests/test_obs_service_gbp.py +++ b/tests/test_obs_service_gbp.py @@ -26,6 +26,7 @@ import stat from nose.tools import assert_raises, eq_, ok_ # pylint: disable=E0611 from obs_service_gbp.command import main as service +from obs_service_gbp_utils import GbpServiceError from tests import UnitTestsBase @@ -37,6 +38,10 @@ def _mock_gbp(): """Fake gbp main function for testing""" raise FakeGbpError() +def _mock_fork_call(*args, **kwargs): + """Fake fork_call function for testing""" + raise GbpServiceError("Mock error, args: %s, kwargs: %s" % (args, kwargs)) + class TestService(UnitTestsBase): """Base class for unit tests""" @@ -108,6 +113,11 @@ class TestService(UnitTestsBase): """Test crash in git-buildpackage-rpm""" eq_(service(['--url', self.orig_repo.path, '--revision=rpm']), 1) + @mock.patch('obs_service_gbp.command.fork_call', _mock_fork_call) + def test_service_error(self): + """Test internal/configuration error""" + eq_(service(['--url', self.orig_repo.path]), 1) + def test_options_outdir(self): """Test the --outdir option""" outdir = os.path.join(self.tmpdir, 'outdir')