Kokkoja as of 2026-10-10: the teacher's requests, the Session window, notices, the QR code, the license
This commit is contained in:
1 parent
95c80d04c9
commit
1d087af633
32 files changed
+4917
-890
No files matched your search
@@ -22,6 +22,9 @@ import kokkoja # noqa: E402
|
||||
TOKEN = "test-token"
|
||||
PAGE = b'<svg xmlns="http://www.w3.org/2000/svg" data-kokkoja="1"/>\n'
|
||||
PNG = b"\x89PNG\r\n\x1a\n" + b"the rest of a picture"
|
||||
TEXT_ONLY_LAYER = (b'<g data-layer="abc" data-name="Andy"><g data-text="t1" data-x="10" data-y="10">'
|
||||
b'<desc>hello</desc><text><tspan>hello</tspan></text></g></g>')
|
||||
|
||||
WRITTEN_PAGE = b'<svg data-kokkoja="1"><g data-layer="a"><g data-stroke="s"/></g></svg>\n'
|
||||
|
||||
|
||||
@@ -64,6 +67,16 @@ class LocalProgramTest(unittest.TestCase):
|
||||
self.assertEqual(self.json("GET", "/config.json", token=None),
|
||||
(200, {"relay": "ws://relay.example:8770", "storage": "files", "site": ""}))
|
||||
|
||||
def test_the_relay_is_remembered(self):
|
||||
config = pathlib.Path(self.directory.name) / "relay_config"
|
||||
self.assertEqual(kokkoja.remembered_relay(config), (None, False))
|
||||
self.assertEqual(kokkoja.remembered_relay(config, "wss://kokkoja.example/relay"),
|
||||
("wss://kokkoja.example/relay", False))
|
||||
self.assertEqual(kokkoja.remembered_relay(config), ("wss://kokkoja.example/relay", True))
|
||||
self.assertEqual(kokkoja.remembered_relay(config, " ws://127.0.0.1:8770 "),
|
||||
("ws://127.0.0.1:8770", False))
|
||||
self.assertEqual((config / "relay").read_text(), "ws://127.0.0.1:8770\n")
|
||||
|
||||
def test_site_comes_from_a_kokkoja_server_relay_or_is_given(self):
|
||||
self.assertEqual(kokkoja.site_of("wss://kokkoja.example/relay", ""), "https://kokkoja.example/")
|
||||
self.assertEqual(kokkoja.site_of("wss://kokkoja.example/relay/", ""), "https://kokkoja.example/")
|
||||
@@ -149,6 +162,10 @@ class LocalProgramTest(unittest.TestCase):
|
||||
self.assertEqual(self.json("GET", "/api/notebooks/Andy")[1]["pages"],
|
||||
[f"{today}_01.svg", f"{today}_02.svg", "Current.svg"])
|
||||
|
||||
# A page with typed text and nothing else is not blank either.
|
||||
self.request("PUT", current, body=b'<svg data-kokkoja="1">' + TEXT_ONLY_LAYER + b"</svg>\n")
|
||||
self.assertEqual(self.json("POST", keep), (200, {"kept": f"{today}_03.svg", "new": True}))
|
||||
|
||||
def test_a_kept_page_is_dated_when_it_was_last_changed(self):
|
||||
notebook = self.notebooks / "Andy"
|
||||
notebook.mkdir(parents=True)
|
||||
|
||||
Reference in new issue
Block a user