"""Tests for abreka status."""

import os

from click.testing import CliRunner

from abreka.cli import main
from abreka.run_control import request_stop_after_current


class TestStatusCommand:
    def test_shows_queued_graceful_stop_when_requested(self, abreka_project):
        runner = CliRunner()
        os.chdir(abreka_project)
        request_stop_after_current(abreka_project / "abreka")

        result = runner.invoke(main, ["status"])

        assert result.exit_code == 0, result.output
        assert "Graceful stop queued" in result.output
        assert "after the current experiment completes" in result.output
