This commit is contained in:
@@ -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