Beispiel #1
0
def get_fake_session(error=None):
    fake_session = mock.MagicMock()
    session.apply_session_helpers(fake_session)

    if error is not None:
        class FakeException(Exception):
            details = [error, "a", "b", "c"]

        fake_session.XenAPI.Failure = FakeException
        fake_session.call_xenapi.side_effect = FakeException

    return fake_session
Beispiel #2
0
def get_fake_session(error=None):
    fake_session = mock.MagicMock()
    session.apply_session_helpers(fake_session)

    if error is not None:
        class FakeException(Exception):
            details = [error, "a", "b", "c"]

        fake_session.XenAPI.Failure = FakeException
        fake_session.call_xenapi.side_effect = FakeException

    return fake_session
 def __init__(self, uri):
     self._session = None
     xenapi_session.apply_session_helpers(self)
Beispiel #4
0
 def __init__(self, uri):
     self._session = None
     xenapi_session.apply_session_helpers(self)
Beispiel #5
0
 def setUp(self):
     super(ApplySessionHelpersTestCase, self).setUp()
     self.session = mock.Mock()
     session.apply_session_helpers(self.session)
Beispiel #6
0
 def setUp(self):
     super(PluginTestBase, self).setUp()
     self.session = mock.Mock()
     session.apply_session_helpers(self.session)
Beispiel #7
0
 def setUp(self):
     super(PluginTestBase, self).setUp()
     self.session = mock.Mock()
     session.apply_session_helpers(self.session)
Beispiel #8
0
 def setUp(self):
     super(ApplySessionHelpersTestCase, self).setUp()
     self.session = mock.Mock()
     session.apply_session_helpers(self.session)