1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
"""
The sign-up form links the hub's privacy statement, the information GDPR
art. 13 owes a person whose data is collected: the French text in French,
the English one in every other language. On the hub that served the page,
like every legal link (platform.legalUrl), never on a hub of somebody else's.
"""
import json
import shutil
import subprocess
import pytest
from spa_source import STATIC
pytestmark = pytest.mark.skipif(shutil.which("node") is None, reason="no node")
def test_each_language_links_its_statement():
probe = (
f"import({json.dumps((STATIC / 'platform.js').as_uri())}).then(p => "
"process.stdout.write(JSON.stringify(['fr', 'en', 'de', 'pt-BR']"
".map(l => p.privacyUrl(l)))))"
)
out = subprocess.run(["node", "-e", probe], capture_output=True, text=True, check=True)
assert json.loads(out.stdout) == [
"/legal/confidentialite.fr.txt",
"/legal/privacy-statement.en.txt",
"/legal/privacy-statement.en.txt",
"/legal/privacy-statement.en.txt",
]
def test_the_sign_up_notice_links_it():
source = (STATIC / "auth-page.js").read_text(encoding="utf-8")
notice = source[source.index("${t('register.legal_notice')}"):]
notice = notice[:notice.index("</a>")]
assert "platform.privacyUrl(getLocale())" in notice
# htm drops whitespace that holds a line break: without it the link is
# glued to the sentence before it.
assert notice.startswith("${t('register.legal_notice')}${' '}")
|