Simplified command sanitization and covered closed clients.
This commit is contained in:
@@ -38,9 +38,6 @@ _SECONDS_PER_DAY = 24 * _SECONDS_PER_HOUR
|
|||||||
|
|
||||||
def _sanitize_for_plain_text(text: str) -> str:
|
def _sanitize_for_plain_text(text: str) -> str:
|
||||||
"""Sanitize text before Markdown escaping."""
|
"""Sanitize text before Markdown escaping."""
|
||||||
if not text:
|
|
||||||
return text
|
|
||||||
|
|
||||||
sanitized = text.replace("\n", " ").replace("\r", " ")
|
sanitized = text.replace("\n", " ").replace("\r", " ")
|
||||||
return " ".join(sanitized.split())
|
return " ".join(sanitized.split())
|
||||||
|
|
||||||
|
|||||||
@@ -477,3 +477,9 @@ class TestOpenConnectionCount:
|
|||||||
async def test_zero_with_no_requests(self, owncast_client: OwncastClient) -> None:
|
async def test_zero_with_no_requests(self, owncast_client: OwncastClient) -> None:
|
||||||
"""Return zero when no requests have been made."""
|
"""Return zero when no requests have been made."""
|
||||||
assert owncast_client.open_connection_count == 0
|
assert owncast_client.open_connection_count == 0
|
||||||
|
|
||||||
|
async def test_zero_after_close(self, owncast_client: OwncastClient) -> None:
|
||||||
|
"""Return zero after the HTTP session has been closed."""
|
||||||
|
await owncast_client.close()
|
||||||
|
|
||||||
|
assert owncast_client.open_connection_count == 0
|
||||||
|
|||||||
Reference in New Issue
Block a user