""" 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("")] 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')}${' '}")