Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
24 lines
983 B
Python
24 lines
983 B
Python
import pytest
|
|
from unittest.mock import patch
|
|
|
|
from app.services.terminal_service import TERMINAL_MAX_SESSIONS_PER_USER
|
|
|
|
|
|
|
|
class TestTerminalStatus:
|
|
@pytest.mark.asyncio
|
|
async def test_terminal_status_available_true(self, client, auth_headers):
|
|
with patch("app.services.terminal_service.terminal_service.check_ttyd_available", return_value=True):
|
|
resp = await client.get("/api/terminal/status", headers=auth_headers)
|
|
assert resp.status_code == 200
|
|
data = resp.json()
|
|
assert data["available"] is True
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_terminal_status_available_false(self, client, auth_headers):
|
|
with patch("app.services.terminal_service.terminal_service.check_ttyd_available", return_value=False):
|
|
resp = await client.get("/api/terminal/status", headers=auth_headers)
|
|
assert resp.status_code == 200
|
|
data = resp.json()
|
|
assert data["available"] is False
|