예제 #1
0
 def test_start(self):
     zrobot = Zrobot('zrobot', data=self.valid_data)
     container = MagicMock()
     zrobot._get_container = MagicMock(return_value=container)
     patch('js9.j.clients.zos.sal.get_node', MagicMock()).start()
     patch('js9.j.clients.zos.sal.get_zerorobot', MagicMock()).start()
     zrobot.start()
     zrobot.state.check('actions', 'start', 'ok')
     container.schedule_action.assert_called_once_with('start')
예제 #2
0
 def test_monitor_service_not_found(self):
     """
     Test monitor when service container can't be found
     """
     zrobot = Zrobot('zrobot', data=self.valid_data)
     zrobot.api.services.get = MagicMock(side_effect=scol.ServiceNotFoundError())
     patch('jumpscale.j.clients.zrobot.get',  MagicMock()).start()
     zrobot.state.set('actions', 'install', 'ok')
     zrobot.state.set('actions', 'start', 'ok')
     zrobot.state.delete = MagicMock(return_value=True)
     zrobot.start = MagicMock()
     zrobot._monitor()
     zrobot.state.delete.assert_called_with('status', 'running')
     zrobot.start.assert_called_once_with()