Skip to content

Commit

Permalink
Updates for Django 5 testing.
Browse files Browse the repository at this point in the history
Add to tox, update python version, POST for logout.
Also update GitHub action versions.
  • Loading branch information
dracos committed May 12, 2024
1 parent 51b18d0 commit 88b52a2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
11 changes: 11 additions & 0 deletions static/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@
| <a href="{% url "criticism" %}">Contact</a>
| {% if user.is_authenticated %}
<a href="{% url "profile" user %}">Your profile</a>
| <a href="{% url "logout" %}">Sign out</a>
|
<form id="logout-form" method="post" action="{% url 'admin:logout' %}"> {% csrf_token %} <button type="submit">Sign out</button> </form>
{% else %}
<a href="{% url "login" %}{% if request.path != '/tickets/returns' %}?next={{ request.path }}{% endif %}">Sign in</a>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion theatricalia/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_user_flow(self):
resp = self.client.post('/tickets/boxoffice', {
'name': 'Test', 'unicorn': '[email protected]', '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)
Expand Down
12 changes: 6 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 88b52a2

Please sign in to comment.