Skip to content

Commit 7d334eb

Browse files
committed
added basic test harness and a sanity check test
1 parent 15d4f7f commit 7d334eb

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ server:
99

1010
migrate:
1111
cd intbot && DJANGO_ENV="dev" uv run ./manage.py migrate
12+
13+
test:
14+
cd intbot && DJANGO_SETTINGS_MODULE="intbot.settings" DJANGO_ENV="test" uv run pytest

intbot/intbot/settings.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,21 @@
118118
}
119119

120120
elif DJANGO_ENV == "test":
121-
...
121+
DEBUG = True
122+
ALLOWED_HOSTS = ["127.0.0.1", "localhost"]
123+
124+
SECRET_KEY = "django-insecure-secret"
125+
126+
DATABASES = {
127+
"default": {
128+
"ENGINE": "django.db.backends.postgresql",
129+
"NAME": "intbot_database_dev",
130+
"USER": "intbot_user",
131+
"PASSWORD": "intbot_password",
132+
"HOST": "localhost",
133+
"PORT": "14672",
134+
}
135+
}
122136

123137

124138
else:

intbot/tests/test_basic.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
This file is currently used to test the test harness.
3+
4+
It checks whether the tests are running, can access databse, etc
5+
"""
6+
7+
from django.contrib.auth.models import User
8+
import pytest
9+
10+
11+
@pytest.mark.django_db
12+
def test_database_sanity_check():
13+
u = User.objects.create(username="Poirot")
14+
15+
assert u.id
16+
assert u.username == "Poirot"

0 commit comments

Comments
 (0)