TOS and Privacy Policy Pages (#1632)

* Adds a legal section where users can add a terms of service and privacy policy
* Optionally show links to the TOS and Privacy Policy on the registration page
* Closes #1621
This commit is contained in:
Kevin Chung
2020-09-07 17:25:47 -04:00
committed by GitHub
parent 37ddfa3bc3
commit 2c505f366d
10 changed files with 174 additions and 5 deletions

27
tests/test_legal.py Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from CTFd.utils import set_config
from tests.helpers import create_ctfd, destroy_ctfd
def test_legal_settings():
app = create_ctfd()
with app.app_context():
set_config("tos_text", "Terms of Service")
set_config("privacy_text", "Privacy Policy")
with app.test_client() as client:
r = client.get("/register")
assert r.status_code == 200
assert "privacy policy" in r.get_data(as_text=True)
assert "terms of service" in r.get_data(as_text=True)
r = client.get("/tos")
assert r.status_code == 200
assert "Terms of Service" in r.get_data(as_text=True)
r = client.get("/privacy")
assert r.status_code == 200
assert "Privacy Policy" in r.get_data(as_text=True)
destroy_ctfd(app)