mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
Add support for robots.txt (#2269)
* Adds support for admins to control `robots.txt` * Closes #2141
This commit is contained in:
@@ -451,3 +451,19 @@ def test_user_can_access_files_if_view_after_ctf():
|
||||
rmdir(directory)
|
||||
|
||||
destroy_ctfd(app)
|
||||
|
||||
|
||||
def test_robots_txt():
|
||||
"""Does the robots.txt page work"""
|
||||
app = create_ctfd()
|
||||
with app.app_context():
|
||||
with app.test_client() as client:
|
||||
r = client.get("/robots.txt")
|
||||
assert r.status_code == 200
|
||||
assert r.get_data(as_text=True) == "User-agent: *\nDisallow: /admin\n"
|
||||
set_config("robots_txt", "testing")
|
||||
with app.test_client() as client:
|
||||
r = client.get("/robots.txt")
|
||||
assert r.status_code == 200
|
||||
assert r.get_data(as_text=True) == "testing"
|
||||
destroy_ctfd(app)
|
||||
|
||||
Reference in New Issue
Block a user