From 88b52a2ed4e16e5c79dfdb1e547e01b6930accbd Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Sun, 12 May 2024 19:55:50 +0100 Subject: [PATCH] Updates for Django 5 testing. Add to tox, update python version, POST for logout. Also update GitHub action versions. --- .github/workflows/default.yml | 8 ++++---- static/css/site.css | 11 +++++++++++ templates/base.html | 3 ++- theatricalia/tests.py | 2 +- tox.ini | 12 ++++++------ 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index d29d965..3eae3b4 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -10,14 +10,14 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.9] - thing-to-test: [flake8, django-v3, django-v41, django-v42] + python-version: [3.11] + thing-to-test: [flake8, django-v3, django-v4, django-v5] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/static/css/site.css b/static/css/site.css index 46d10b1..b614e46 100644 --- a/static/css/site.css +++ b/static/css/site.css @@ -402,6 +402,17 @@ li#nav-plays a { padding-top: 1.5em; } +#logout-form { + display: inline; +} +#logout-form button { + background: none; + border: none; + cursor: pointer; + padding: 0; + text-decoration: underline; +} + .primary { margin-bottom: 1.5em; } diff --git a/templates/base.html b/templates/base.html index 0162c19..f43b198 100644 --- a/templates/base.html +++ b/templates/base.html @@ -144,7 +144,8 @@ | Contact | {% if user.is_authenticated %} Your profile -| Sign out +| +
{% csrf_token %}
{% else %} Sign in {% endif %} diff --git a/theatricalia/tests.py b/theatricalia/tests.py index 1c9d8a8..f23d3a7 100644 --- a/theatricalia/tests.py +++ b/theatricalia/tests.py @@ -58,7 +58,7 @@ def test_user_flow(self): resp = self.client.post('/tickets/boxoffice', { 'name': 'Test', 'unicorn': 'test@example.org', 'username': 'test', 'password': 'test'}) self.assertContains(resp, 'You are now registered and logged in') - resp = self.client.get('/tickets/returns') + resp = self.client.post('/tickets/returns') self.assertContains(resp, 'You are now signed out') resp = self.client.post('/tickets', {'username': 'test', 'password': 'test'}, follow=True) self.assertRedirects(resp, '/profile/test', status_code=302) diff --git a/tox.ini b/tox.ini index 8dd1136..1ae25ae 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,16 @@ [tox] skipsdist = True -envlist = flake8, django-v{3,41,42} +envlist = flake8, django-v{3,4,5} [testenv] -basepython = python3.9 +basepython = python3.11 commands = python -W all -W ignore::PendingDeprecationWarning -m coverage run manage.py test --keepdb deps = coverage -r{toxinidir}/requirements-base.txt v3: Django>=3,<4 - v41: Django>=4.1,<4.2 - v42: Django>=4.2,<5 + v4: Django>=4,<5 + v5: Django>=5,<6 [testenv:flake8] basepython = python3 @@ -27,5 +27,5 @@ extend-ignore=E402,E722,E501 THING_TO_TEST = flake8: flake8 django-v3: django-v3 - django-v41: django-v41 - django-v42: django-v42 + django-v4: django-v4 + django-v5: django-v5