Skip to content

Commit a01010b

Browse files
authored
Merge pull request #40 from RSE-Sheffield/chore/manage-py-check
Add Django check workflow
2 parents bbb646e + de4fc9e commit a01010b

File tree

7 files changed

+71
-5
lines changed

7 files changed

+71
-5
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run Django tests
2+
on:
3+
push:
4+
branches: [ "main" ]
5+
pull_request:
6+
branches: [ "main" ]
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-24.04
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
- name: Setup Python
14+
uses: actions/[email protected]
15+
with:
16+
# This should match the version used in production
17+
python-version: "3.12"
18+
- name: Install dependencies
19+
run: |
20+
# Update pip
21+
python -m pip install --upgrade pip
22+
# https://pip.pypa.io/en/stable/cli/pip_install/
23+
pip install --requirement requirements.txt
24+
# https://docs.djangoproject.com/en/5.1/ref/django-admin/#check
25+
- name: Run Django system checks
26+
run: python manage.py check
27+
# https://docs.djangoproject.com/en/5.1/topics/testing/
28+
- name: Run Django test suites
29+
run: |
30+
export DJANGO_SECRET_KEY="$(python -c "import secrets; print(secrets.token_urlsafe())")"
31+
python manage.py test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[![Run Django checks](https://github.com/RSE-Sheffield/SORT/actions/workflows/django-check.yaml/badge.svg)](https://github.com/RSE-Sheffield/SORT/actions/workflows/django-check.yaml)
12
# SORT
23
### Self-Assessment of Organisational Readiness Tool
34

home/tests.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

home/tests/test_home.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import django.test
2+
3+
4+
class HomeTestCase(django.test.TestCase):
5+
6+
def test_welcome_page(self):
7+
"""
8+
Welcome page
9+
"""
10+
self.client.get("/")

home/tests/test_project.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import django.test
2+
3+
4+
class ProjectTestCase(django.test.TestCase):
5+
6+
def test_projects_page(self):
7+
"""
8+
Test the profiles list page.
9+
"""
10+
self.client.get("/projects")

home/tests/test_user.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import django.test
2+
3+
4+
class UserTestCase(django.test.TestCase):
5+
6+
def test_profile_page(self):
7+
"""
8+
Test the user profile page
9+
"""
10+
self.client.get("/profile")

invites/tests.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
# from django.test import TestCase
1+
import django.test
22

3-
# Create your tests here.
3+
4+
class InviteTestCase(django.test.TestCase):
5+
6+
def test_invite_page(self):
7+
"""
8+
Send out invitation page.
9+
"""
10+
self.client.get("/invite/")

0 commit comments

Comments
 (0)