tests/: add tos-gate test and CI workflow

29 tests across four classes:
- TestTosGatedDownloads (9) - macro unit tests: URL absent from HTML,
  base64/JSON roundtrip, group format encoding, checkbox attributes,
  prose_section_id, tos_url override
- TestTosCheckbox (4) - legacy macro: element presence, section ID, URL
  defaults/override
- TestTosGateJs (7) - JS file: function defined, noreferrer absent from link
  template but warning comment present, data-prose-group selector present, group
  branch present, prose hidden on uncheck
- TestStaticFiles (9) - no plain dl.3mdeb.com links, correct macro usage in
  variants/ files, tos-gate.js in mkdocs.yml, permalink: true, referrer meta in
  overrides/main.html

Signed-off-by: Artur Raglis <artur.raglis@3mdeb.com>
This commit is contained in:
Artur Raglis
2026-05-17 19:08:48 +02:00
parent 8d0d41b5ee
commit d61a48d134
4 changed files with 245 additions and 21 deletions
+38
View File
@@ -0,0 +1,38 @@
---
name: ToS gate tests
on:
push:
branches:
- master
- main
paths:
- main.py
- docs/javascripts/tos-gate.js
- overrides/main.html
- mkdocs.yml
- docs/**
- tests/test_tos_gate.py
- requirements.txt
pull_request:
paths:
- main.py
- docs/javascripts/tos-gate.js
- overrides/main.html
- mkdocs.yml
- docs/**
- tests/test_tos_gate.py
- requirements.txt
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run ToS gate tests
run: pytest tests/test_tos_gate.py -v