def test_stop_before_starting(self): """ Test stopping without starting """ with pytest.raises(StateCheckError, message='Stop before start should raise an error'): zrobot = Zrobot('zrobot', data=self.valid_data) zrobot.stop()
def test_stop(self): zrobot = Zrobot('zrobot', data=self.valid_data) zrobot.api.services.get = MagicMock() patch('js9.j.clients.zos.sal.get_zerorobot', MagicMock()).start() zrobot.state.set('actions', 'start', 'ok') zrobot.state.delete = MagicMock(return_value=True) zrobot.stop() zrobot.state.delete.assert_called_with('status', 'running')