Selectively mock requests_kerberos import

To ensure consistent test behaviour need to mock the import of
requests_kerberos to be None only for the test classes based
off of the default JenkinsTestBase

Change-Id: I79903a6b3e4a1677fa1a1980af9f73c84b385828
Depends-On: I56c9580be9a90f5cda7349a148d467e6ff4e9270
Darragh Bailey 2018-06-01 15:07:07 +01:00
parent a3c3672a6f
commit f56e719ec9
1 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import sys
import mock
from testscenarios import TestWithScenarios
import jenkins
@ -24,11 +25,17 @@ class JenkinsTestBase(TestWithScenarios, unittest.TestCase):
def setUp(self):
super(JenkinsTestBase, self).setUp()
# TODO(darragh) would be useful if this could be mocked
jenkins.requests_kerberos = None
self.request_kerberos_module_patcher = mock.patch(
'jenkins.requests_kerberos', None)
self.j = jenkins.Jenkins(self.base_url, 'test', 'test')
def tearDown(self):
def make_url(self, path):
return u'{0}/{1}'.format(self.base_url, path)