From edbf7cf8354eb42f6c86ac0dc2c419f027bd5744 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Sun, 5 Dec 2021 15:32:18 +0100 Subject: [PATCH 1/4] Update requirements --- poetry.lock | 175 +++++++++++++++++++++++++------------------------ pyproject.toml | 9 ++- 2 files changed, 95 insertions(+), 89 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3981e05..1b470c1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -123,7 +123,7 @@ webencodings = "*" [[package]] name = "bx-django-utils" -version = "11" +version = "14" description = "Various Django utility functions" category = "main" optional = false @@ -136,7 +136,7 @@ python-stdnum = "*" [[package]] name = "bx-py-utils" -version = "50" +version = "52" description = "Various Python utility functions" category = "main" optional = false @@ -171,7 +171,7 @@ pycparser = "*" [[package]] name = "charset-normalizer" -version = "2.0.7" +version = "2.0.9" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." category = "main" optional = false @@ -182,7 +182,7 @@ unicode_backport = ["unicodedata2"] [[package]] name = "cmd2" -version = "2.3.1" +version = "2.3.3" description = "cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python" category = "dev" optional = false @@ -241,7 +241,7 @@ development = ["black", "flake8", "mypy", "pytest", "types-colorama"] [[package]] name = "coverage" -version = "6.1.2" +version = "6.2" description = "Code coverage measurement for Python" category = "dev" optional = false @@ -566,7 +566,7 @@ python-versions = "*" [[package]] name = "docutils" -version = "0.18" +version = "0.18.1" description = "Docutils -- Python Documentation Utilities" category = "dev" optional = false @@ -733,7 +733,7 @@ format_nongpl = ["idna", "jsonpointer (>1.13)", "webcolors", "rfc3986-validator [[package]] name = "keyring" -version = "23.2.1" +version = "23.4.0" description = "Store and access your passwords safely." category = "dev" optional = false @@ -746,8 +746,8 @@ pywin32-ctypes = {version = "<0.1.0 || >0.1.0,<0.1.1 || >0.1.1", markers = "sys_ SecretStorage = {version = ">=3.2", markers = "sys_platform == \"linux\""} [package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"] +docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"] +testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"] [[package]] name = "lxml" @@ -836,7 +836,7 @@ pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" [[package]] name = "paramiko" -version = "2.8.0" +version = "2.8.1" description = "SSH2 protocol library" category = "main" optional = true @@ -863,14 +863,14 @@ python-versions = ">=3.6" [[package]] name = "pkginfo" -version = "1.8.1" +version = "1.8.2" description = "Query metadatdata from sdists / bdists / installed packages." category = "dev" optional = false python-versions = "*" [package.extras] -testing = ["nose", "coverage"] +testing = ["coverage", "nose"] [[package]] name = "platformdirs" @@ -1089,7 +1089,7 @@ testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtuale [[package]] name = "pytest-django" -version = "4.4.0" +version = "4.5.1" description = "A Django plugin for pytest." category = "dev" optional = false @@ -1116,7 +1116,7 @@ tblib = "*" [[package]] name = "pytest-randomly" -version = "3.10.2" +version = "3.10.3" description = "Pytest plugin to randomly order tests and control random.seed." category = "dev" optional = false @@ -1478,7 +1478,7 @@ wsproto = ">=0.14" [[package]] name = "twine" -version = "3.6.0" +version = "3.7.0" description = "Collection of utilities for publishing packages on PyPI" category = "dev" optional = false @@ -1488,7 +1488,7 @@ python-versions = ">=3.6" colorama = ">=0.4.3" importlib-metadata = ">=3.6" keyring = ">=15.1" -pkginfo = ">=1.4.2" +pkginfo = ">=1.8.1" readme-renderer = ">=21.0" requests = ">=2.20" requests-toolbelt = ">=0.8.0,<0.9.0 || >0.9.0" @@ -1497,7 +1497,7 @@ tqdm = ">=4.14" [[package]] name = "typing-extensions" -version = "4.0.0" +version = "4.0.1" description = "Backported and Experimental Type Hints for Python 3.6+" category = "main" optional = false @@ -1670,12 +1670,12 @@ bleach = [ {file = "bleach-4.1.0.tar.gz", hash = "sha256:0900d8b37eba61a802ee40ac0061f8c2b5dee29c1927dd1d233e075ebf5a71da"}, ] bx-django-utils = [ - {file = "bx_django_utils-11-py3-none-any.whl", hash = "sha256:b4115fbffb5b788e3ed6c13f5aa9d87991da35f1235de4376ca3e780d03546e9"}, - {file = "bx_django_utils-11.tar.gz", hash = "sha256:a7549c6fd6b9a745e8949c6dfede825433d532c907e86140b7b8fb19cb63945c"}, + {file = "bx_django_utils-14-py3-none-any.whl", hash = "sha256:f5b9722e5b58f68580dc54d05b6b4c983c12d13f98dde7183b324e628d720aef"}, + {file = "bx_django_utils-14.tar.gz", hash = "sha256:6d6728dcc05cbb3dcfb432f0e6a585b1b86f45604c2b31437d48626dcdb4b1d6"}, ] bx-py-utils = [ - {file = "bx_py_utils-50-py3-none-any.whl", hash = "sha256:3713ee75904c061eb934d2ab7a842760a8e0fb99db3b69ff5bd6841aa9ef04ae"}, - {file = "bx_py_utils-50.tar.gz", hash = "sha256:8799ffd2a12f5aff9654cafd486990ee1a3e5a7be4d00c35f6b0449843568316"}, + {file = "bx_py_utils-52-py3-none-any.whl", hash = "sha256:f80f5ab57a0af61338c4b3f0213c65b0d664dce4cd539d5d546f8cac62c61268"}, + {file = "bx_py_utils-52.tar.gz", hash = "sha256:e61bcca793d4d63fbb263f16ab20b86ab09fe4f4fc995f143f8aa4ca20e8ab01"}, ] cached-property = [ {file = "cached-property-1.5.2.tar.gz", hash = "sha256:9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130"}, @@ -1738,12 +1738,12 @@ cffi = [ {file = "cffi-1.15.0.tar.gz", hash = "sha256:920f0d66a896c2d99f0adbb391f990a84091179542c205fa53ce5787aff87954"}, ] charset-normalizer = [ - {file = "charset-normalizer-2.0.7.tar.gz", hash = "sha256:e019de665e2bcf9c2b64e2e5aa025fa991da8720daa3c1138cadd2fd1856aed0"}, - {file = "charset_normalizer-2.0.7-py3-none-any.whl", hash = "sha256:f7af805c321bfa1ce6714c51f254e0d5bb5e5834039bc17db7ebe3a4cec9492b"}, + {file = "charset-normalizer-2.0.9.tar.gz", hash = "sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c"}, + {file = "charset_normalizer-2.0.9-py3-none-any.whl", hash = "sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721"}, ] cmd2 = [ - {file = "cmd2-2.3.1-py3-none-any.whl", hash = "sha256:9df7400aadb3f8f65d12665eb8c9dc86b03a08d93599c7f7cb0b71f945759afc"}, - {file = "cmd2-2.3.1.tar.gz", hash = "sha256:44f9d93bbcd90c6dda70e73db722d6b27b551d98bef28bd82fd14ccbe88d18ea"}, + {file = "cmd2-2.3.3-py3-none-any.whl", hash = "sha256:871713244c1f31defa3250149ba3ed071130be33bc755f39b84ae7ef6f721951"}, + {file = "cmd2-2.3.3.tar.gz", hash = "sha256:750d7eb04d55c3bc2a413e191bc177856f388102de47d11f2210a35266543640"}, ] cmd2-ext-test = [ {file = "cmd2-ext-test-2.0.0.tar.gz", hash = "sha256:b9373ea27bab2e297041ed2dac4491dc919ae56153d5f0addeb440eeb851a5a6"}, @@ -1758,53 +1758,53 @@ colorlog = [ {file = "colorlog-6.6.0.tar.gz", hash = "sha256:344f73204009e4c83c5b6beb00b3c45dc70fcdae3c80db919e0a4171d006fde8"}, ] coverage = [ - {file = "coverage-6.1.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:675adb3b3380967806b3cbb9c5b00ceb29b1c472692100a338730c1d3e59c8b9"}, - {file = "coverage-6.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:95a58336aa111af54baa451c33266a8774780242cab3704b7698d5e514840758"}, - {file = "coverage-6.1.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:d0a595a781f8e186580ff8e3352dd4953b1944289bec7705377c80c7e36c4d6c"}, - {file = "coverage-6.1.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d3c5f49ce6af61154060640ad3b3281dbc46e2e0ef2fe78414d7f8a324f0b649"}, - {file = "coverage-6.1.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:310c40bed6b626fd1f463e5a83dba19a61c4eb74e1ac0d07d454ebbdf9047e9d"}, - {file = "coverage-6.1.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:a4d48e42e17d3de212f9af44f81ab73b9378a4b2b8413fd708d0d9023f2bbde4"}, - {file = "coverage-6.1.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ffa545230ca2ad921ad066bf8fd627e7be43716b6e0fcf8e32af1b8188ccb0ab"}, - {file = "coverage-6.1.2-cp310-cp310-win32.whl", hash = "sha256:cd2d11a59afa5001ff28073ceca24ae4c506da4355aba30d1e7dd2bd0d2206dc"}, - {file = "coverage-6.1.2-cp310-cp310-win_amd64.whl", hash = "sha256:96129e41405887a53a9cc564f960d7f853cc63d178f3a182fdd302e4cab2745b"}, - {file = "coverage-6.1.2-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:1de9c6f5039ee2b1860b7bad2c7bc3651fbeb9368e4c4d93e98a76358cdcb052"}, - {file = "coverage-6.1.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:80cb70264e9a1d04b519cdba3cd0dc42847bf8e982a4d55c769b9b0ee7cdce1e"}, - {file = "coverage-6.1.2-cp311-cp311-win_amd64.whl", hash = "sha256:ba6125d4e55c0b8e913dad27b22722eac7abdcb1f3eab1bd090eee9105660266"}, - {file = "coverage-6.1.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8492d37acdc07a6eac6489f6c1954026f2260a85a4c2bb1e343fe3d35f5ee21a"}, - {file = "coverage-6.1.2-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:66af99c7f7b64d050d37e795baadf515b4561124f25aae6e1baa482438ecc388"}, - {file = "coverage-6.1.2-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:ebcc03e1acef4ff44f37f3c61df478d6e469a573aa688e5a162f85d7e4c3860d"}, - {file = "coverage-6.1.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98d44a8136eebbf544ad91fef5bd2b20ef0c9b459c65a833c923d9aa4546b204"}, - {file = "coverage-6.1.2-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:c18725f3cffe96732ef96f3de1939d81215fd6d7d64900dcc4acfe514ea4fcbf"}, - {file = "coverage-6.1.2-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:c8e9c4bcaaaa932be581b3d8b88b677489975f845f7714efc8cce77568b6711c"}, - {file = "coverage-6.1.2-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:06d009e8a29483cbc0520665bc46035ffe9ae0e7484a49f9782c2a716e37d0a0"}, - {file = "coverage-6.1.2-cp36-cp36m-win32.whl", hash = "sha256:e5432d9c329b11c27be45ee5f62cf20a33065d482c8dec1941d6670622a6fb8f"}, - {file = "coverage-6.1.2-cp36-cp36m-win_amd64.whl", hash = "sha256:82fdcb64bf08aa5db881db061d96db102c77397a570fbc112e21c48a4d9cb31b"}, - {file = "coverage-6.1.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:94f558f8555e79c48c422045f252ef41eb43becdd945e9c775b45ebfc0cbd78f"}, - {file = "coverage-6.1.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:046647b96969fda1ae0605f61288635209dd69dcd27ba3ec0bf5148bc157f954"}, - {file = "coverage-6.1.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:cc799916b618ec9fd00135e576424165691fec4f70d7dc12cfaef09268a2478c"}, - {file = "coverage-6.1.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:62646d98cf0381ffda301a816d6ac6c35fc97aa81b09c4c52d66a15c4bef9d7c"}, - {file = "coverage-6.1.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:27a3df08a855522dfef8b8635f58bab81341b2fb5f447819bc252da3aa4cf44c"}, - {file = "coverage-6.1.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:610c0ba11da8de3a753dc4b1f71894f9f9debfdde6559599f303286e70aeb0c2"}, - {file = "coverage-6.1.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:35b246ae3a2c042dc8f410c94bcb9754b18179cdb81ff9477a9089dbc9ecc186"}, - {file = "coverage-6.1.2-cp37-cp37m-win32.whl", hash = "sha256:0cde7d9fe2fb55ff68ebe7fb319ef188e9b88e0a3d1c9c5db7dd829cd93d2193"}, - {file = "coverage-6.1.2-cp37-cp37m-win_amd64.whl", hash = "sha256:958ac66272ff20e63d818627216e3d7412fdf68a2d25787b89a5c6f1eb7fdd93"}, - {file = "coverage-6.1.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:a300b39c3d5905686c75a369d2a66e68fd01472ea42e16b38c948bd02b29e5bd"}, - {file = "coverage-6.1.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d3855d5d26292539861f5ced2ed042fc2aa33a12f80e487053aed3bcb6ced13"}, - {file = "coverage-6.1.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:586d38dfc7da4a87f5816b203ff06dd7c1bb5b16211ccaa0e9788a8da2b93696"}, - {file = "coverage-6.1.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a34fccb45f7b2d890183a263578d60a392a1a218fdc12f5bce1477a6a68d4373"}, - {file = "coverage-6.1.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:bc1ee1318f703bc6c971da700d74466e9b86e0c443eb85983fb2a1bd20447263"}, - {file = "coverage-6.1.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:3f546f48d5d80a90a266769aa613bc0719cb3e9c2ef3529d53f463996dd15a9d"}, - {file = "coverage-6.1.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fd92ece726055e80d4e3f01fff3b91f54b18c9c357c48fcf6119e87e2461a091"}, - {file = "coverage-6.1.2-cp38-cp38-win32.whl", hash = "sha256:24ed38ec86754c4d5a706fbd5b52b057c3df87901a8610d7e5642a08ec07087e"}, - {file = "coverage-6.1.2-cp38-cp38-win_amd64.whl", hash = "sha256:97ef6e9119bd39d60ef7b9cd5deea2b34869c9f0b9777450a7e3759c1ab09b9b"}, - {file = "coverage-6.1.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6e5a8c947a2a89c56655ecbb789458a3a8e3b0cbf4c04250331df8f647b3de59"}, - {file = "coverage-6.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a39590d1e6acf6a3c435c5d233f72f5d43b585f5be834cff1f21fec4afda225"}, - {file = "coverage-6.1.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:9d2c2e3ce7b8cc932a2f918186964bd44de8c84e2f9ef72dc616f5bb8be22e71"}, - {file = "coverage-6.1.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3348865798c077c695cae00da0924136bb5cc501f236cfd6b6d9f7a3c94e0ec4"}, - {file = "coverage-6.1.2-cp39-cp39-win32.whl", hash = "sha256:fae3fe111670e51f1ebbc475823899524e3459ea2db2cb88279bbfb2a0b8a3de"}, - {file = "coverage-6.1.2-cp39-cp39-win_amd64.whl", hash = "sha256:af45eea024c0e3a25462fade161afab4f0d9d9e0d5a5d53e86149f74f0a35ecc"}, - {file = "coverage-6.1.2-pp36.pp37.pp38-none-any.whl", hash = "sha256:eab14fdd410500dae50fd14ccc332e65543e7b39f6fc076fe90603a0e5d2f929"}, - {file = "coverage-6.1.2.tar.gz", hash = "sha256:d9a635114b88c0ab462e0355472d00a180a5fbfd8511e7f18e4ac32652e7d972"}, + {file = "coverage-6.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6dbc1536e105adda7a6312c778f15aaabe583b0e9a0b0a324990334fd458c94b"}, + {file = "coverage-6.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:174cf9b4bef0db2e8244f82059a5a72bd47e1d40e71c68ab055425172b16b7d0"}, + {file = "coverage-6.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:92b8c845527eae547a2a6617d336adc56394050c3ed8a6918683646328fbb6da"}, + {file = "coverage-6.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c7912d1526299cb04c88288e148c6c87c0df600eca76efd99d84396cfe00ef1d"}, + {file = "coverage-6.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d5d2033d5db1d58ae2d62f095e1aefb6988af65b4b12cb8987af409587cc0739"}, + {file = "coverage-6.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:3feac4084291642165c3a0d9eaebedf19ffa505016c4d3db15bfe235718d4971"}, + {file = "coverage-6.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:276651978c94a8c5672ea60a2656e95a3cce2a3f31e9fb2d5ebd4c215d095840"}, + {file = "coverage-6.2-cp310-cp310-win32.whl", hash = "sha256:f506af4f27def639ba45789fa6fde45f9a217da0be05f8910458e4557eed020c"}, + {file = "coverage-6.2-cp310-cp310-win_amd64.whl", hash = "sha256:3f7c17209eef285c86f819ff04a6d4cbee9b33ef05cbcaae4c0b4e8e06b3ec8f"}, + {file = "coverage-6.2-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:13362889b2d46e8d9f97c421539c97c963e34031ab0cb89e8ca83a10cc71ac76"}, + {file = "coverage-6.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:22e60a3ca5acba37d1d4a2ee66e051f5b0e1b9ac950b5b0cf4aa5366eda41d47"}, + {file = "coverage-6.2-cp311-cp311-win_amd64.whl", hash = "sha256:b637c57fdb8be84e91fac60d9325a66a5981f8086c954ea2772efe28425eaf64"}, + {file = "coverage-6.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f467bbb837691ab5a8ca359199d3429a11a01e6dfb3d9dcc676dc035ca93c0a9"}, + {file = "coverage-6.2-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2641f803ee9f95b1f387f3e8f3bf28d83d9b69a39e9911e5bfee832bea75240d"}, + {file = "coverage-6.2-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1219d760ccfafc03c0822ae2e06e3b1248a8e6d1a70928966bafc6838d3c9e48"}, + {file = "coverage-6.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:9a2b5b52be0a8626fcbffd7e689781bf8c2ac01613e77feda93d96184949a98e"}, + {file = "coverage-6.2-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:8e2c35a4c1f269704e90888e56f794e2d9c0262fb0c1b1c8c4ee44d9b9e77b5d"}, + {file = "coverage-6.2-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:5d6b09c972ce9200264c35a1d53d43ca55ef61836d9ec60f0d44273a31aa9f17"}, + {file = "coverage-6.2-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:e3db840a4dee542e37e09f30859f1612da90e1c5239a6a2498c473183a50e781"}, + {file = "coverage-6.2-cp36-cp36m-win32.whl", hash = "sha256:4e547122ca2d244f7c090fe3f4b5a5861255ff66b7ab6d98f44a0222aaf8671a"}, + {file = "coverage-6.2-cp36-cp36m-win_amd64.whl", hash = "sha256:01774a2c2c729619760320270e42cd9e797427ecfddd32c2a7b639cdc481f3c0"}, + {file = "coverage-6.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:fb8b8ee99b3fffe4fd86f4c81b35a6bf7e4462cba019997af2fe679365db0c49"}, + {file = "coverage-6.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:619346d57c7126ae49ac95b11b0dc8e36c1dd49d148477461bb66c8cf13bb521"}, + {file = "coverage-6.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:0a7726f74ff63f41e95ed3a89fef002916c828bb5fcae83b505b49d81a066884"}, + {file = "coverage-6.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cfd9386c1d6f13b37e05a91a8583e802f8059bebfccde61a418c5808dea6bbfa"}, + {file = "coverage-6.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:17e6c11038d4ed6e8af1407d9e89a2904d573be29d51515f14262d7f10ef0a64"}, + {file = "coverage-6.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c254b03032d5a06de049ce8bca8338a5185f07fb76600afff3c161e053d88617"}, + {file = "coverage-6.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:dca38a21e4423f3edb821292e97cec7ad38086f84313462098568baedf4331f8"}, + {file = "coverage-6.2-cp37-cp37m-win32.whl", hash = "sha256:600617008aa82032ddeace2535626d1bc212dfff32b43989539deda63b3f36e4"}, + {file = "coverage-6.2-cp37-cp37m-win_amd64.whl", hash = "sha256:bf154ba7ee2fd613eb541c2bc03d3d9ac667080a737449d1a3fb342740eb1a74"}, + {file = "coverage-6.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f9afb5b746781fc2abce26193d1c817b7eb0e11459510fba65d2bd77fe161d9e"}, + {file = "coverage-6.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:edcada2e24ed68f019175c2b2af2a8b481d3d084798b8c20d15d34f5c733fa58"}, + {file = "coverage-6.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:a9c8c4283e17690ff1a7427123ffb428ad6a52ed720d550e299e8291e33184dc"}, + {file = "coverage-6.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f614fc9956d76d8a88a88bb41ddc12709caa755666f580af3a688899721efecd"}, + {file = "coverage-6.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:9365ed5cce5d0cf2c10afc6add145c5037d3148585b8ae0e77cc1efdd6aa2953"}, + {file = "coverage-6.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:8bdfe9ff3a4ea37d17f172ac0dff1e1c383aec17a636b9b35906babc9f0f5475"}, + {file = "coverage-6.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:63c424e6f5b4ab1cf1e23a43b12f542b0ec2e54f99ec9f11b75382152981df57"}, + {file = "coverage-6.2-cp38-cp38-win32.whl", hash = "sha256:49dbff64961bc9bdd2289a2bda6a3a5a331964ba5497f694e2cbd540d656dc1c"}, + {file = "coverage-6.2-cp38-cp38-win_amd64.whl", hash = "sha256:9a29311bd6429be317c1f3fe4bc06c4c5ee45e2fa61b2a19d4d1d6111cb94af2"}, + {file = "coverage-6.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:03b20e52b7d31be571c9c06b74746746d4eb82fc260e594dc662ed48145e9efd"}, + {file = "coverage-6.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:215f8afcc02a24c2d9a10d3790b21054b58d71f4b3c6f055d4bb1b15cecce685"}, + {file = "coverage-6.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:a4bdeb0a52d1d04123b41d90a4390b096f3ef38eee35e11f0b22c2d031222c6c"}, + {file = "coverage-6.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c332d8f8d448ded473b97fefe4a0983265af21917d8b0cdcb8bb06b2afe632c3"}, + {file = "coverage-6.2-cp39-cp39-win32.whl", hash = "sha256:6e1394d24d5938e561fbeaa0cd3d356207579c28bd1792f25a068743f2d5b282"}, + {file = "coverage-6.2-cp39-cp39-win_amd64.whl", hash = "sha256:86f2e78b1eff847609b1ca8050c9e1fa3bd44ce755b2ec30e70f2d3ba3844644"}, + {file = "coverage-6.2-pp36.pp37.pp38-none-any.whl", hash = "sha256:5829192582c0ec8ca4a2532407bc14c2f338d9878a10442f5d03804a95fac9de"}, + {file = "coverage-6.2.tar.gz", hash = "sha256:e2cad8093172b7d1595b4ad66f24270808658e11acf43a8f95b41276162eb5b8"}, ] coveralls = [ {file = "coveralls-3.3.1-py2.py3-none-any.whl", hash = "sha256:f42015f31d386b351d4226389b387ae173207058832fbf5c8ec4b40e27b16026"}, @@ -1923,8 +1923,8 @@ docopt = [ {file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"}, ] docutils = [ - {file = "docutils-0.18-py2.py3-none-any.whl", hash = "sha256:a31688b2ea858517fa54293e5d5df06fbb875fb1f7e4c64529271b77781ca8fc"}, - {file = "docutils-0.18.tar.gz", hash = "sha256:c1d5dab2b11d16397406a282e53953fe495a46d69ae329f55aa98a5c4e3c5fbb"}, + {file = "docutils-0.18.1-py2.py3-none-any.whl", hash = "sha256:23010f129180089fbcd3bc08cfefccb3b890b0050e1ca00c867036e9d161b98c"}, + {file = "docutils-0.18.1.tar.gz", hash = "sha256:679987caf361a7539d76e584cbeddc311e3aee937877c87346f31debc63e9d06"}, ] et-xmlfile = [ {file = "et_xmlfile-1.1.0-py3-none-any.whl", hash = "sha256:a2ba85d1d6a74ef63837eed693bcb89c3f752169b0e3e7ae5b16ca5e1b3deada"}, @@ -1991,8 +1991,8 @@ jsonschema = [ {file = "jsonschema-3.2.0.tar.gz", hash = "sha256:c8a85b28d377cc7737e46e2d9f2b4f44ee3c0e1deac6bf46ddefc7187d30797a"}, ] keyring = [ - {file = "keyring-23.2.1-py3-none-any.whl", hash = "sha256:bd2145a237ed70c8ce72978b497619ddfcae640b6dcf494402d5143e37755c6e"}, - {file = "keyring-23.2.1.tar.gz", hash = "sha256:6334aee6073db2fb1f30892697b1730105b5e9a77ce7e61fca6b435225493efe"}, + {file = "keyring-23.4.0-py3-none-any.whl", hash = "sha256:3dc0f66062a4f8f6f2ce30d6a516e6e623e6c3c2e76864204ceaf64695408f07"}, + {file = "keyring-23.4.0.tar.gz", hash = "sha256:88f206024295e3c6fb16bb0a60fb4bb7ec1185629dc5a729f12aa7c236d01387"}, ] lxml = [ {file = "lxml-4.6.4-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:bbf2dc330bd44bfc0254ab37677ec60f7c7ecea55ad8ba1b8b2ea7bf20c265f5"}, @@ -2084,8 +2084,8 @@ packaging = [ {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, ] paramiko = [ - {file = "paramiko-2.8.0-py2.py3-none-any.whl", hash = "sha256:def3ec612399bab4e9f5eb66b0ae5983980db9dd9120d9e9c6ea3ff673865d1c"}, - {file = "paramiko-2.8.0.tar.gz", hash = "sha256:e673b10ee0f1c80d46182d3af7751d033d9b573dd7054d2d0aa46be186c3c1d2"}, + {file = "paramiko-2.8.1-py2.py3-none-any.whl", hash = "sha256:7b5910f5815a00405af55da7abcc8a9e0d9657f57fcdd9a89894fdbba1c6b8a8"}, + {file = "paramiko-2.8.1.tar.gz", hash = "sha256:85b1245054e5d7592b9088cc6d08da22445417912d3a3e48138675c7a8616438"}, ] pillow = [ {file = "Pillow-8.4.0-cp310-cp310-macosx_10_10_universal2.whl", hash = "sha256:81f8d5c81e483a9442d72d182e1fb6dcb9723f289a57e8030811bac9ea3fef8d"}, @@ -2131,8 +2131,8 @@ pillow = [ {file = "Pillow-8.4.0.tar.gz", hash = "sha256:b8e2f83c56e141920c39464b852de3719dfbfb6e3c99a2d8da0edf4fb33176ed"}, ] pkginfo = [ - {file = "pkginfo-1.8.1-py2.py3-none-any.whl", hash = "sha256:bb55a6c017d50f2faea5153abc7b05a750e7ea7ae2cbb7fb3ad6f1dcf8d40988"}, - {file = "pkginfo-1.8.1.tar.gz", hash = "sha256:65175ffa2c807220673a41c371573ac9a1ea1b19ffd5eef916278f428319934f"}, + {file = "pkginfo-1.8.2-py2.py3-none-any.whl", hash = "sha256:c24c487c6a7f72c66e816ab1796b96ac6c3d14d49338293d2141664330b55ffc"}, + {file = "pkginfo-1.8.2.tar.gz", hash = "sha256:542e0d0b6750e2e21c20179803e40ab50598d8066d51097a0e382cba9eb02bff"}, ] platformdirs = [ {file = "platformdirs-2.4.0-py3-none-any.whl", hash = "sha256:8868bbe3c3c80d42f20156f22e7131d2fb321f5bc86a2a345375c6481a67021d"}, @@ -2296,16 +2296,16 @@ pytest-cov = [ {file = "pytest_cov-3.0.0-py3-none-any.whl", hash = "sha256:578d5d15ac4a25e5f961c938b85a05b09fdaae9deef3bb6de9a6e766622ca7a6"}, ] pytest-django = [ - {file = "pytest-django-4.4.0.tar.gz", hash = "sha256:b5171e3798bf7e3fc5ea7072fe87324db67a4dd9f1192b037fed4cc3c1b7f455"}, - {file = "pytest_django-4.4.0-py3-none-any.whl", hash = "sha256:65783e78382456528bd9d79a35843adde9e6a47347b20464eb2c885cb0f1f606"}, + {file = "pytest-django-4.5.1.tar.gz", hash = "sha256:01fe1242e706375d7c942d206a30826bd9c0dffde99bfac627050cdc91f0d792"}, + {file = "pytest_django-4.5.1-py3-none-any.whl", hash = "sha256:13a956a0016cd37f889d5d3a8a36c0c90da44d6fdc7704e4e13f08d2f76f78f7"}, ] pytest-parallel = [ {file = "pytest-parallel-0.1.1.tar.gz", hash = "sha256:9aac3fc199a168c0a8559b60249d9eb254de7af58c12cee0310b54d4affdbfab"}, {file = "pytest_parallel-0.1.1-py3-none-any.whl", hash = "sha256:9e3703015b0eda52be9e07d2ba3498f09340a56d5c79a39b50f22fc5c38212fe"}, ] pytest-randomly = [ - {file = "pytest-randomly-3.10.2.tar.gz", hash = "sha256:2c0a332c4b124e372e2473803bcc91ec87797664f4955afef2b844c0021662b1"}, - {file = "pytest_randomly-3.10.2-py3-none-any.whl", hash = "sha256:cbd5c50b7c41491c202c71a3df33a75619d610a4f5c34aa2bd02ac30fce7cd43"}, + {file = "pytest-randomly-3.10.3.tar.gz", hash = "sha256:22154cdcff7ba44e0599596490e6b75278ca973a33812ea6a54bf14d0b042ef1"}, + {file = "pytest_randomly-3.10.3-py3-none-any.whl", hash = "sha256:b05a7a45f54cae2b5095752c6a10cb559df84448421b0420ae492dd2fb1727ef"}, ] python-creole = [ {file = "python-creole-1.4.10.tar.gz", hash = "sha256:6429aedc7cef578fe681d7781ad12dbea6ee54e03937b0e1b697e4cae5ff80bb"}, @@ -2456,11 +2456,12 @@ trio-websocket = [ {file = "trio_websocket-0.9.2-py3-none-any.whl", hash = "sha256:5b558f6e83cc20a37c3b61202476c5295d1addf57bd65543364e0337e37ed2bc"}, ] twine = [ - {file = "twine-3.6.0-py3-none-any.whl", hash = "sha256:916070f8ecbd1985ebed5dbb02b9bda9a092882a96d7069d542d4fc0bb5c673c"}, - {file = "twine-3.6.0.tar.gz", hash = "sha256:4caad5ef4722e127b3749052fcbffaaf71719b19d4fd4973b29c469957adeba2"}, + {file = "twine-3.7.0-py3-none-any.whl", hash = "sha256:5a3e3fb52b926827c99e050f0c1e5d8ae599848f3eb27764f19b886c09134590"}, + {file = "twine-3.7.0.tar.gz", hash = "sha256:8d6a0ad895576c97e9ad4a5da2d6adea37fd5434ecabace0054013d537ddbc6c"}, ] typing-extensions = [ - {file = "typing_extensions-4.0.0-py3-none-any.whl", hash = "sha256:829704698b22e13ec9eaf959122315eabb370b0884400e9818334d8b677023d9"}, + {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, + {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, ] urllib3 = [ {file = "urllib3-1.26.7-py2.py3-none-any.whl", hash = "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844"}, diff --git a/pyproject.toml b/pyproject.toml index e1af555..9279c3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,13 +11,14 @@ packages = [ keywords=['inventory','django'] classifiers = [ # http://pypi.python.org/pypi?%3Aaction=list_classifiers - "Development Status :: 4 - Beta", - #"Development Status :: 5 - Production/Stable", + "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: End Users/Desktop", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3 :: Only", 'Framework :: Django', "Topic :: Database :: Front-Ends", @@ -32,6 +33,10 @@ include = ['AUTHORS', 'LICENSE', 'README.creole'] # Will be generated from README.creole with: 'poetry run update_rst_readme' readme='README.rst' +[tool.poetry.urls] +"Bug Tracker" = "https://github.com/jedie/PyInventory/issues" + + [tool.poetry.dependencies] python = ">=3.7,<4.0.0" colorlog = "*" # https://github.com/borntyping/python-colorlog From 60cc68602a8087d8a48ec2bac87f2379e1f829d6 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Sun, 5 Dec 2021 16:10:54 +0100 Subject: [PATCH 2/4] setup DEBUG in tests --- pyproject.toml | 4 ++++ src/inventory_project/settings/base.py | 1 + src/inventory_project/settings/local.py | 2 +- src/inventory_project/settings/tests.py | 6 +++++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9279c3b..0cc2279 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,6 +134,10 @@ omit = [".*"] # https://docs.pytest.org/en/latest/customize.html#pyproject-toml minversion = "6.0" DJANGO_SETTINGS_MODULE="inventory_project.settings.tests" + +# Don't overwrite settings.DEBUG: +django_debug_mode="keep" + norecursedirs = ".* .git __pycache__ coverage* dist htmlcov volumes" # sometimes helpfull "addopts" arguments: # -vv diff --git a/src/inventory_project/settings/base.py b/src/inventory_project/settings/base.py index fdb1250..8788469 100644 --- a/src/inventory_project/settings/base.py +++ b/src/inventory_project/settings/base.py @@ -38,6 +38,7 @@ print(f'BASE_PATH:{BASE_PATH}') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False +TEMPLATE_DEBUG = False # Serve static/media files by Django? # In production Caddy should serve this! diff --git a/src/inventory_project/settings/local.py b/src/inventory_project/settings/local.py index 90fa681..fca9601 100644 --- a/src/inventory_project/settings/local.py +++ b/src/inventory_project/settings/local.py @@ -11,7 +11,7 @@ from inventory_project.settings.base import * # noqa # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True - +TEMPLATE_DEBUG = True # Serve static/media files for local development: SERVE_FILES = True diff --git a/src/inventory_project/settings/tests.py b/src/inventory_project/settings/tests.py index 99f415a..9e788b5 100644 --- a/src/inventory_project/settings/tests.py +++ b/src/inventory_project/settings/tests.py @@ -12,7 +12,11 @@ DATABASES = { SECRET_KEY = 'No individual secret for tests ;)' -DEBUG = True +# Run the tests as on production: Without DBEUG: +DEBUG = False +TEMPLATE_DEBUG = False + +ALLOWED_HOSTS = ('127.0.0.1', '0.0.0.0', 'localhost') LOGGING['formatters']['colored']['format'] = ( '%(log_color)s%(name)s %(levelname)8s %(cut_path)s:%(lineno)-3s %(message)s' From e7cb83633c0a36cc9bc02598ad446ebafcfa3208 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Sun, 5 Dec 2021 16:22:02 +0100 Subject: [PATCH 3/4] Test "manage.py check" in tests --- src/inventory_project/tests/test_project_setup.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/inventory_project/tests/test_project_setup.py b/src/inventory_project/tests/test_project_setup.py index 6f5ad18..c316157 100644 --- a/src/inventory_project/tests/test_project_setup.py +++ b/src/inventory_project/tests/test_project_setup.py @@ -5,6 +5,7 @@ from pathlib import Path from creole.setup_utils import update_rst_readme from django.conf import settings +from django.core import checks from django.test import TestCase import inventory @@ -93,3 +94,17 @@ class ProjectSettingsTestCase(TestCase): assert len(dirs) == 1 template_path = Path(dirs[0]).resolve() assert template_path.is_dir() + + def test_manage_check(self): + all_issues = checks.run_checks( + app_configs=None, + tags=None, + include_deployment_checks=True, + databases=None, + ) + if all_issues: + print('=' * 100) + for issue in all_issues: + print(issue) + print('=' * 100) + raise AssertionError('There are check issues!') From d019a98b78c69d573277f1b1ad0e29b2fda07e5d Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Sun, 5 Dec 2021 16:22:24 +0100 Subject: [PATCH 4/4] Activate secure settings by default --- src/inventory/tests/test_item_images.py | 33 +++++++- src/inventory_project/settings/base.py | 25 ++++++ src/inventory_project/settings/local.py | 10 +++ src/inventory_project/settings/tests.py | 2 +- src/inventory_project/tests/test_admin.py | 13 +-- .../tests/test_admin_item.py | 35 +++++++- .../test_admin_item_login_1.snapshot.html | 81 +++++++++++++++++++ .../tests/test_admin_memo.py | 12 ++- 8 files changed, 194 insertions(+), 17 deletions(-) create mode 100644 src/inventory_project/tests/test_admin_item_login_1.snapshot.html diff --git a/src/inventory/tests/test_item_images.py b/src/inventory/tests/test_item_images.py index 10e575c..ea004a0 100644 --- a/src/inventory/tests/test_item_images.py +++ b/src/inventory/tests/test_item_images.py @@ -10,6 +10,7 @@ from inventory.models import ItemImageModel from inventory.tests.fixtures.users import get_normal_pyinventory_user +# @override_settings(SECURE_SSL_REDIRECT=False) class ItemImagesTestCase(TestCase): def test_basics(self): with mock.patch('secrets.token_urlsafe', return_value='user1token'): @@ -40,23 +41,47 @@ class ItemImagesTestCase(TestCase): url = image_instance.image.url assert url == '/media/user1token/12345678901234567890/mock_img.jpeg' + # HTTP -> HTTPS redirect: + response = self.client.get( + '/media/user1token/12345678901234567890/mock_img.jpeg', + secure=False + ) + self.assertRedirects( + response, + status_code=301, + expected_url='https://testserver/media/user1token/12345678901234567890/mock_img.jpeg', + fetch_redirect_response=False, + ) + # Anonymous has no access: - response = self.client.get('/media/user1token/12345678901234567890/mock_img.jpeg') + response = self.client.get( + '/media/user1token/12345678901234567890/mock_img.jpeg', + secure=True, + ) assert response.status_code == 403 # Can't access with wrong user: self.client.force_login(pyinventory_user2) - response = self.client.get('/media/user1token/12345678901234567890/mock_img.jpeg') + response = self.client.get( + '/media/user1token/12345678901234567890/mock_img.jpeg', + secure=True, + ) assert response.status_code == 403 # Can access with the right user: self.client.force_login(pyinventory_user1) - response = self.client.get('/media/user1token/12345678901234567890/mock_img.jpeg') + response = self.client.get( + '/media/user1token/12345678901234567890/mock_img.jpeg', + secure=True, + ) assert response.status_code == 200 assert isinstance(response, FileResponse) assert response.getvalue() == image_instance.image.open('rb').read() # Test whats happen, if token was deleted UserMediaTokenModel.objects.all().delete() - response = self.client.get('/media/user1token/12345678901234567890/mock_img.jpeg') + response = self.client.get( + '/media/user1token/12345678901234567890/mock_img.jpeg', + secure=True, + ) assert response.status_code == 400 # SuspiciousOperation -> HttpResponseBadRequest diff --git a/src/inventory_project/settings/base.py b/src/inventory_project/settings/base.py index 8788469..500e0c1 100644 --- a/src/inventory_project/settings/base.py +++ b/src/inventory_project/settings/base.py @@ -131,6 +131,31 @@ TEMPLATES = [ }, ] +# _____________________________________________________________________________ + +# Mark CSRF cookie as "secure" -> browsers sent cookie only with an HTTPS connection: +CSRF_COOKIE_SECURE = True + +# Mark session cookie as "secure" -> browsers sent cookie only with an HTTPS connection: +SESSION_COOKIE_SECURE = True + +# HTTP header/value combination that signifies a request is secure +# Your nginx.conf must set "X-Forwarded-Protocol" proxy header! +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') + +# SecurityMiddleware should redirects all non-HTTPS requests to HTTPS: +SECURE_SSL_REDIRECT = True + +# SecurityMiddleware should preload directive to the HTTP Strict Transport Security header: +SECURE_HSTS_PRELOAD = True + +# Instruct modern browsers to refuse to connect to your domain name via an insecure connection: +SECURE_HSTS_SECONDS = 3600 + +# SecurityMiddleware should add the "includeSubDomains" directive to the Strict-Transport-Security +# header: All subdomains of your domain should be served exclusively via SSL! +SECURE_HSTS_INCLUDE_SUBDOMAINS = True + # _____________________________________________________________________________ # Internationalization diff --git a/src/inventory_project/settings/local.py b/src/inventory_project/settings/local.py index fca9601..13eeff6 100644 --- a/src/inventory_project/settings/local.py +++ b/src/inventory_project/settings/local.py @@ -34,6 +34,16 @@ DATABASES = { } } print(f'Use Database: {DATABASES["default"]["NAME"]!r}', file=__sys.stderr) +# _____________________________________________________________________________ + +# Disable security features, because development server doesn't support HTTPS +CSRF_COOKIE_SECURE = False +SESSION_COOKIE_SECURE = False +SECURE_PROXY_SSL_HEADER = None +SECURE_SSL_REDIRECT = False +SECURE_HSTS_PRELOAD = False +SECURE_HSTS_SECONDS = 0 +SECURE_HSTS_INCLUDE_SUBDOMAINS = False # _____________________________________________________________________________ # AlwaysLoggedInAsSuperUser diff --git a/src/inventory_project/settings/tests.py b/src/inventory_project/settings/tests.py index 9e788b5..caca43d 100644 --- a/src/inventory_project/settings/tests.py +++ b/src/inventory_project/settings/tests.py @@ -10,7 +10,7 @@ DATABASES = { } } -SECRET_KEY = 'No individual secret for tests ;)' +SECRET_KEY = 'No individual secret... But this settings should only be used in tests ;)' # Run the tests as on production: Without DBEUG: DEBUG = False diff --git a/src/inventory_project/tests/test_admin.py b/src/inventory_project/tests/test_admin.py index 43c4940..e1b6dee 100644 --- a/src/inventory_project/tests/test_admin.py +++ b/src/inventory_project/tests/test_admin.py @@ -2,7 +2,7 @@ import os import unittest from django.contrib.auth.models import User -from django.test import TestCase +from django.test import TestCase, override_settings from django_processinfo.models import ProcessInfo, SiteStatistics from django_tools.selenium.chromedriver import chromium_available from django_tools.selenium.django import ( @@ -22,14 +22,15 @@ class AdminAnonymousTests(TestCase): """ def test_login_en(self): - response = self.client.get("/admin/", HTTP_ACCEPT_LANGUAGE="en") - self.assertRedirects(response, expected_url="/admin/login/?next=/admin/") + response = self.client.get('/admin/', secure=True, HTTP_ACCEPT_LANGUAGE='en') + self.assertRedirects(response, expected_url='/admin/login/?next=/admin/', fetch_redirect_response=False) def test_login_de(self): - response = self.client.get("/admin/", HTTP_ACCEPT_LANGUAGE="de") - self.assertRedirects(response, expected_url="/admin/login/?next=/admin/") + response = self.client.get('/admin/', secure=True, HTTP_ACCEPT_LANGUAGE='de') + self.assertRedirects(response, expected_url='/admin/login/?next=/admin/', fetch_redirect_response=False) +@override_settings(SECURE_SSL_REDIRECT=False) class ProcessinfoAdminTestCase(TestCase): @classmethod def setUpTestData(cls): @@ -87,6 +88,7 @@ class ProcessinfoAdminTestCase(TestCase): @unittest.skipIf('CI' in os.environ, 'Skip, selenium tests does not work on CI run!') @unittest.skipUnless(chromium_available(), "Skip because Chromium is not available!") +@override_settings(SECURE_SSL_REDIRECT=False) class AdminChromiumTests(SeleniumChromiumStaticLiveServerTestCase): def test_admin_login_page(self): self.driver.get(self.live_server_url + "/admin/login/") @@ -97,6 +99,7 @@ class AdminChromiumTests(SeleniumChromiumStaticLiveServerTestCase): @unittest.skipIf('CI' in os.environ, 'Skip, selenium tests does not work on CI run!') @unittest.skipUnless(firefox_available(), "Skip because Firefox is not available!") +@override_settings(SECURE_SSL_REDIRECT=False) class AdminFirefoxTests(SeleniumFirefoxStaticLiveServerTestCase): def test_admin_login_page(self): self.driver.get(self.live_server_url + "/admin/login/") diff --git a/src/inventory_project/tests/test_admin_item.py b/src/inventory_project/tests/test_admin_item.py index bda1ef6..79f0b71 100644 --- a/src/inventory_project/tests/test_admin_item.py +++ b/src/inventory_project/tests/test_admin_item.py @@ -7,7 +7,7 @@ from bx_django_utils.test_utils.html_assertion import HtmlAssertionMixin from bx_py_utils.test_utils.snapshot import assert_html_snapshot from django.contrib.auth.models import User from django.template.defaulttags import CsrfTokenNode, NowNode -from django.test import TestCase +from django.test import TestCase, override_settings from django.utils import timezone from django_tools.unittest_utils.mockup import ImageDummy from model_bakery import baker @@ -46,15 +46,42 @@ ITEM_FORM_DEFAULTS = { ITEM_FORM_DEFAULTS = tuple(ITEM_FORM_DEFAULTS.items()) -class AdminAnonymousTests(TestCase): +class AdminAnonymousTests(HtmlAssertionMixin, TestCase): def test_login(self): - response = self.client.get('/admin/inventory/itemmodel/add/', HTTP_ACCEPT_LANGUAGE='en') + # HTTP -> HTTPS redirect: + response = self.client.get('/admin/', HTTP_ACCEPT_LANGUAGE='en') self.assertRedirects( response, - expected_url='/admin/login/?next=/admin/inventory/itemmodel/add/' + expected_url='https://testserver/admin/', + status_code=301, # Permanent redirect + fetch_redirect_response=False ) + response = self.client.get( + path='/admin/inventory/itemmodel/add/', + secure=True, + HTTP_ACCEPT_LANGUAGE='en' + ) + self.assertRedirects( + response, + expected_url='/admin/login/?next=/admin/inventory/itemmodel/add/', + fetch_redirect_response=False + ) + with mock.patch.object(CsrfTokenNode, 'render', return_value='MockedCsrfTokenNode'): + response = self.client.get( + path='/admin/login/', + secure=True, + HTTP_ACCEPT_LANGUAGE='en' + ) + self.assert_html_parts(response, parts=( + f'Log in | PyInventory v{__version__}', + '', + '', + )) + assert_html_response_snapshot(response, validate=False) + +@override_settings(SECURE_SSL_REDIRECT=False) class AdminTestCase(HtmlAssertionMixin, TestCase): @classmethod def setUpTestData(cls): diff --git a/src/inventory_project/tests/test_admin_item_login_1.snapshot.html b/src/inventory_project/tests/test_admin_item_login_1.snapshot.html new file mode 100644 index 0000000..e5d92a6 --- /dev/null +++ b/src/inventory_project/tests/test_admin_item_login_1.snapshot.html @@ -0,0 +1,81 @@ + + + + + Log in | PyInventory v0.12.0 + + + + + + + + + + + + + + + + +
+ + + +
+
+ +
+ + MockedCsrfTokenNode +
+

+ + +

+

+ + +

+
+
+ + + +
+ +
+
+ +
+
+
+ + + diff --git a/src/inventory_project/tests/test_admin_memo.py b/src/inventory_project/tests/test_admin_memo.py index ed1b3e7..54dcb1b 100644 --- a/src/inventory_project/tests/test_admin_memo.py +++ b/src/inventory_project/tests/test_admin_memo.py @@ -3,7 +3,7 @@ from unittest import mock from bx_django_utils.test_utils.html_assertion import HtmlAssertionMixin from django.contrib.auth.models import User from django.template.defaulttags import CsrfTokenNode, NowNode -from django.test import TestCase +from django.test import TestCase, override_settings from django_tools.unittest_utils.mockup import ImageDummy from model_bakery import baker @@ -15,13 +15,19 @@ from inventory_project.tests.temp_utils import assert_html_response_snapshot class AdminAnonymousTests(TestCase): def test_login(self): - response = self.client.get('/admin/inventory/memomodel/add/', HTTP_ACCEPT_LANGUAGE='en') + response = self.client.get( + '/admin/inventory/memomodel/add/', + secure=True, + HTTP_ACCEPT_LANGUAGE='en' + ) self.assertRedirects( response, - expected_url='/admin/login/?next=/admin/inventory/memomodel/add/' + expected_url='/admin/login/?next=/admin/inventory/memomodel/add/', + fetch_redirect_response=False, ) +@override_settings(SECURE_SSL_REDIRECT=False) class AdminTestCase(HtmlAssertionMixin, TestCase): @classmethod def setUpTestData(cls):