Files
computer-playbook/tests/unit/python/roles/web-app-nextcloud/test_onlyoffice_check_deadline.py
T
kevinveenbirkenbachandClaude Opus 5.5 1c35cdef91 style: apply the autoformat output main drifted from
`make quality-high` on main (fea6f31d9f) rewrote two files in its
autoformat step:

- roles/sys-service/handlers/refresh_systemctl_service.yml: the
  handler's `when` was wrapped by hand; the formatter wraps it at line
  width. Both forms parse to the same YAML.
- tests/unit/python/roles/web-app-nextcloud/test_onlyoffice_check_deadline.py:
  two over-long assertIn calls that ruff format splits.

A second autoformat run leaves the tree unchanged, so main is stable
under the formatter again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 01:35:21 +02:00

34 lines
1.1 KiB
Python

from __future__ import annotations
import unittest
from utils.cache.files import PROJECT_ROOT, read_text
from utils.cache.yaml import load_yaml_str
TASKS = PROJECT_ROOT / "roles/web-app-nextcloud/tasks/addons/onlyoffice.yml"
class TestOnlyofficeCheckDeadline(unittest.TestCase):
def setUp(self) -> None:
self.tasks = load_yaml_str(read_text(str(TASKS)))
def test_the_deadline_is_set_before_the_check(self) -> None:
deadline, check = self.tasks
self.assertIn("nextcloud_onlyoffice_check_deadline", deadline["set_fact"])
self.assertIn(
"lookup('timeout'",
deadline["set_fact"]["nextcloud_onlyoffice_check_deadline"],
)
self.assertEqual(check["register"], "nextcloud_onlyoffice_check")
def test_the_retries_stop_at_the_deadline(self) -> None:
until = self.tasks[1]["until"]
self.assertIn("nextcloud_onlyoffice_check.rc == 0", until)
self.assertIn(
"now(utc=true).timestamp() > nextcloud_onlyoffice_check_deadline", until
)
if __name__ == "__main__":
unittest.main()