def test_init(self): self._netweaver = netweaver.NetweaverInstance('ha1', 1, 'pass', remote_host='remote') self.assertEqual('ha1', self._netweaver.sid) self.assertEqual('01', self._netweaver.inst) self.assertEqual('pass', self._netweaver._password) self.assertEqual('remote', self._netweaver.remote_host) with self.assertRaises(TypeError) as err: self._netweaver = netweaver.NetweaverInstance(1, '00', 'pass') self.assertTrue( 'provided sid, inst and password parameters must be str type' in str(err.exception)) self.assertTrue( 'provided sid, inst and password parameters must be str type' in str(err.exception)) with self.assertRaises(TypeError) as err: self._netweaver = netweaver.NetweaverInstance('ha1', '00', 1234) self.assertTrue( 'provided sid, inst and password parameters must be str type' in str(err.exception))
def _init(sid=None, inst=None, password=None): ''' Returns an instance of the netweaver instance sid Netweaver system id (PRD for example) inst Netweaver instance number (00 for example) password Netweaver instance password ''' if sid is None: sid = __salt__['config.option']('netweaver.sid', None) if inst is None: inst = __salt__['config.option']('netweaver.inst', None) if password is None: password = __salt__['config.option']('netweaver.password', None) try: return netweaver.NetweaverInstance(sid, inst, password) except TypeError as err: raise exceptions.SaltInvocationError(err)
def setUp(self): """ Test setUp. """ self._netweaver = netweaver.NetweaverInstance('ha1', '00', 'pass')
from shaptools import netweaver nw = netweaver.NetweaverInstance('ha1', '00', 'your_password') print nw.is_installed()