This commit is contained in:
@@ -34,7 +34,9 @@ def looks_like_content_root(path: Path) -> bool:
|
||||
def resolve_root() -> Path:
|
||||
env_root = os.environ.get("AUTHOR_ROOT")
|
||||
if env_root:
|
||||
return Path(env_root).expanduser().resolve()
|
||||
resolved = Path(env_root).expanduser().resolve()
|
||||
if looks_like_content_root(resolved):
|
||||
return resolved
|
||||
candidates = [
|
||||
Path.cwd(),
|
||||
Path(__file__).resolve().parent,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
See the categories: @@html:<a href="../home/categories.html">Categories</a>@@
|
||||
|
||||
* Posts:
|
||||
- [[file:career/career-list.org][Career List]] @@html:<span class="post-date">07-05-2026 16:31</span>@@
|
||||
- [[file:career/career-list.org][Career List]] @@html:<span class="post-date">07-05-2026 16:35</span>@@
|
||||
- [[file:posts-list.sync-conflict-20260417-233432-VT6366A.org][Posts List]] @@html:<span class="post-date">14-04-2026 16:36</span>@@
|
||||
- [[file:career/ha-dr.org][High Availability, Disaster Recovery and Business Continuity]] @@html:<span class="post-date">11-03-2026 17:18</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
||||
- [[file:career/javascript.org][Understands the Javascript language]] @@html:<span class="post-date">11-03-2026 16:52</span>@@ @@html:<a href="/tags/learning.html"><span class="post-tag">learning</span></a>@@ @@html:<a href="/tags/notes.html"><span class="post-tag">notes</span></a>@@
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
- [[file:tags/notes.org][Tag: notes]]
|
||||
- [[file:tags/review.org][Tag: review]]
|
||||
- [[file:tags/website.org][Tag: website]]
|
||||
- [[file:tags/update.org][Tag: update]]
|
||||
- [[file:tags/life.org][Tag: life]]
|
||||
- [[file:tags/education.org][Tag: education]]
|
||||
- [[file:tags/update.org][Tag: update]]
|
||||
- [[file:tags/insights.org][Tag: insights]]
|
||||
- [[file:tags/reading.org][Tag: reading]]
|
||||
- [[file:tags/emacs.org][Tag: emacs]]
|
||||
- [[file:tags/reading.org][Tag: reading]]
|
||||
- [[file:tags/maths.org][Tag: maths]]
|
||||
- home
|
||||
- [[file:home/countdown.org][Countdown]]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
@@ -42,6 +43,14 @@ class AuthoringServerTestCase(unittest.TestCase):
|
||||
|
||||
|
||||
class UtilityTests(AuthoringServerTestCase):
|
||||
def test_resolve_root_ignores_invalid_author_root(self):
|
||||
wrong_root = self.root / "empty"
|
||||
wrong_root.mkdir()
|
||||
(self.root / "authoring_server.py").write_text("", encoding="utf-8")
|
||||
|
||||
with mock.patch.dict(os.environ, {"AUTHOR_ROOT": str(wrong_root)}), mock.patch.object(server.Path, "cwd", return_value=self.root):
|
||||
self.assertEqual(server.resolve_root(), self.root)
|
||||
|
||||
def test_slugify_normalises_text_and_keeps_fallback(self):
|
||||
self.assertEqual(server.slugify("Hello, Org Web!"), "hello-org-web")
|
||||
self.assertEqual(server.slugify(" "), "untitled")
|
||||
|
||||
Reference in New Issue
Block a user