Files
CTFd/tests/admin/test_pages.py
Kevin Chung dc3a4d275b Fix issue with previewing certain pages (#1571)
* Fix previewing pages when page attributes are set
2020-07-24 14:52:35 -04:00

27 lines
823 B
Python

from tests.helpers import create_ctfd, destroy_ctfd, login_as_user
def test_previewing_pages_works():
"""Test that pages can be previewed properly"""
app = create_ctfd()
with app.app_context():
client = login_as_user(app, name="admin", password="password")
with client.session_transaction() as sess:
data = {
"title": "title",
"route": "route",
"content": "content_testing",
"nonce": sess.get("nonce"),
"draft": "y",
"hidden": "y",
"auth_required": "y",
}
r = client.post("/admin/pages/preview", data=data)
assert r.status_code == 200
resp = r.get_data(as_text=True)
assert "content_testing" in resp
destroy_ctfd(app)