Compare commits

..

No commits in common. "0fef13c71aa3524403b15cb8a7413dde19b5282c" and "55cfad90a961f4c1d5bdb2d8cba2d6107c52305b" have entirely different histories.

5 changed files with 69 additions and 75 deletions

View File

@ -4,10 +4,9 @@ import logging
import os
import re
from flask import Blueprint, abort
from flask import Blueprint, Markup, abort
from flask import current_app as app
from flask import redirect, request, send_from_directory
from markupsafe import Markup
from werkzeug.security import safe_join
from incorporealcms.lib import get_meta_str, init_md, render

View File

@ -1,37 +1,39 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements/requirements-dev.txt requirements/requirements-dev.in
#
bandit==1.7.5
attrs==22.2.0
# via pytest
bandit==1.7.4
# via -r requirements/requirements-dev.in
blinker==1.6.3
# via flask
build==1.0.3
build==0.9.0
# via pip-tools
certifi==2023.7.22
certifi==2022.12.7
# via requests
charset-normalizer==3.3.0
charset-normalizer==2.1.1
# via requests
click==8.1.7
click==8.1.3
# via
# flask
# pip-tools
# safety
coverage[toml]==7.3.2
coverage[toml]==7.0.1
# via pytest-cov
distlib==0.3.7
distlib==0.3.6
# via virtualenv
dlint==0.14.1
dlint==0.13.0
# via -r requirements/requirements-dev.in
dparse==0.6.3
dparse==0.6.2
# via safety
filelock==3.12.4
exceptiongroup==1.1.0
# via pytest
filelock==3.9.0
# via
# tox
# virtualenv
flake8==6.1.0
flake8==5.0.4
# via
# -r requirements/requirements-dev.in
# dlint
@ -44,46 +46,42 @@ flake8-blind-except==0.2.1
# via -r requirements/requirements-dev.in
flake8-builtins==2.1.0
# via -r requirements/requirements-dev.in
flake8-docstrings==1.7.0
flake8-docstrings==1.6.0
# via -r requirements/requirements-dev.in
flake8-executable==2.1.3
flake8-executable==2.1.2
# via -r requirements/requirements-dev.in
flake8-fixme==1.1.1
# via -r requirements/requirements-dev.in
flake8-isort==6.1.0
flake8-isort==6.0.0
# via -r requirements/requirements-dev.in
flake8-logging-format==0.9.0
# via -r requirements/requirements-dev.in
flake8-mutable==1.2.0
# via -r requirements/requirements-dev.in
flask==3.0.0
flask==2.2.2
# via -r requirements/requirements.in
gitdb==4.0.10
# via gitpython
gitpython==3.1.37
gitpython==3.1.30
# via bandit
idna==3.4
# via requests
iniconfig==2.0.0
iniconfig==1.1.1
# via pytest
isort==5.12.0
isort==5.11.4
# via flake8-isort
itsdangerous==2.1.2
# via flask
jinja2==3.1.2
# via flask
markdown==3.5
markdown==3.4.1
# via -r requirements/requirements.in
markdown-it-py==3.0.0
# via rich
markupsafe==2.1.3
markupsafe==2.1.1
# via
# jinja2
# werkzeug
mccabe==0.7.0
# via flake8
mdurl==0.1.2
# via markdown-it-py
packaging==21.3
# via
# build
@ -91,75 +89,80 @@ packaging==21.3
# pytest
# safety
# tox
pbr==5.11.1
pbr==5.11.0
# via stevedore
pip-tools==7.3.0
pep517==0.13.0
# via build
pip-tools==6.12.1
# via -r requirements/requirements-dev.in
platformdirs==3.11.0
platformdirs==2.6.2
# via virtualenv
pluggy==1.3.0
pluggy==1.0.0
# via
# pytest
# tox
py==1.11.0
# via tox
pycodestyle==2.11.0
pycodestyle==2.9.1
# via flake8
pydocstyle==6.3.0
pydocstyle==6.1.1
# via flake8-docstrings
pydot==1.4.2
# via -r requirements/requirements-dev.in
pyflakes==3.1.0
pyflakes==2.5.0
# via flake8
pygments==2.16.1
# via rich
pyparsing==3.1.1
pyparsing==3.0.9
# via
# packaging
# pydot
pyproject-hooks==1.0.0
# via build
pytest==7.4.2
pytest==7.2.0
# via
# -r requirements/requirements-dev.in
# pytest-cov
pytest-cov==4.1.0
pytest-cov==4.0.0
# via -r requirements/requirements-dev.in
pyyaml==6.0.1
pyyaml==6.0
# via bandit
requests==2.31.0
requests==2.28.1
# via safety
rich==13.6.0
# via bandit
ruamel-yaml==0.17.35
ruamel-yaml==0.17.21
# via safety
ruamel-yaml-clib==0.2.8
ruamel-yaml-clib==0.2.7
# via ruamel-yaml
safety==2.3.5
# via -r requirements/requirements-dev.in
six==1.16.0
# via tox
smmap==5.0.1
smmap==5.0.0
# via gitdb
snowballstemmer==2.2.0
# via pydocstyle
stevedore==5.1.0
stevedore==4.1.1
# via bandit
toml==0.10.2
# via dparse
tomli==2.0.1
# via
# build
# coverage
# pep517
# pytest
# tox
tox==3.28.0
# via
# -r requirements/requirements-dev.in
# tox-wheel
tox-wheel==1.0.0
# via -r requirements/requirements-dev.in
urllib3==2.0.6
urllib3==1.26.13
# via requests
versioneer==0.29
versioneer==0.28
# via -r requirements/requirements-dev.in
virtualenv==20.24.5
virtualenv==20.17.1
# via tox
werkzeug==3.0.0
werkzeug==2.2.2
# via flask
wheel==0.41.2
wheel==0.38.4
# via
# pip-tools
# tox-wheel

View File

@ -1,24 +1,22 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile --output-file=requirements/requirements.txt requirements/requirements.in
#
blinker==1.6.3
click==8.1.3
# via flask
click==8.1.7
# via flask
flask==3.0.0
flask==2.2.2
# via -r requirements/requirements.in
itsdangerous==2.1.2
# via flask
jinja2==3.1.2
# via flask
markdown==3.5
markdown==3.4.1
# via -r requirements/requirements.in
markupsafe==2.1.3
markupsafe==2.1.1
# via
# jinja2
# werkzeug
werkzeug==3.0.0
werkzeug==2.2.2
# via flask

View File

@ -184,18 +184,18 @@ def test_that_dir_request_does_not_redirect(client):
def test_setting_selected_style_includes_cookie(client):
"""Test that a request with style=foo sets the cookie and renders appropriately."""
response = client.get('/')
style_cookie = client.get_cookie('user-style')
style_cookie = next((cookie for cookie in client.cookie_jar if cookie.name == 'user-style'), None)
assert style_cookie is None
response = client.get('/?style=light')
style_cookie = client.get_cookie('user-style')
style_cookie = next((cookie for cookie in client.cookie_jar if cookie.name == 'user-style'), None)
assert response.status_code == 200
assert b'/static/css/light.css' in response.data
assert b'/static/css/dark.css' not in response.data
assert style_cookie.value == 'light'
response = client.get('/?style=dark')
style_cookie = client.get_cookie('user-style')
style_cookie = next((cookie for cookie in client.cookie_jar if cookie.name == 'user-style'), None)
assert response.status_code == 200
assert b'/static/css/dark.css' in response.data
assert b'/static/css/light.css' not in response.data

View File

@ -4,7 +4,7 @@
# and then run "tox" from this directory.
[tox]
envlist = begin,py38,py39,py310,py311,coverage,security,lint,bundle
envlist = begin,py38,py39,py310,coverage,security,lint,bundle
[testenv]
# build a wheel and test it
@ -46,11 +46,6 @@ commands =
commands =
pytest --cov-append --cov={envsitepackagesdir}/incorporealcms/ --cov-branch
[testenv:py311]
# run pytest with coverage
commands =
pytest --cov-append --cov={envsitepackagesdir}/incorporealcms/ --cov-branch
[testenv:coverage]
# report on coverage runs from above
skip_install = true
@ -96,7 +91,6 @@ exclude =
versioneer.py
_version.py
instance/
venv/
extend-ignore = T101
max-complexity = 10
max-line-length = 120