Skip to content

Commit f08b6da

Browse files
committed
Add ability and instructions for running tests with sqlite
1 parent 05abba8 commit f08b6da

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

backend/manager/manager/settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
from pathlib import Path
14+
import os
1415

1516
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1617
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -87,6 +88,12 @@
8788
}
8889
}
8990

91+
if (os.getenv('DB') == 'sqlite'):
92+
DATABASES['default'] = {
93+
'ENGINE': 'django.db.backends.sqlite3',
94+
'NAME': 'mydatabase',
95+
}
96+
9097

9198
# Password validation
9299
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators

readme.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ To delete the cluster:
1414
$ k3d cluster delete amit-mini-project
1515
```
1616

17+
## Running the Tests
18+
19+
Tests are easiest to run using sqlite. Use the following sequence of commands:
20+
21+
```s
22+
$Env:DB="sqlite"
23+
poetry shell
24+
python manage.py test
25+
```
26+
1727
# DRF Useful Links
1828

1929
- A solution to the wierd API endpoinds in the form of `user/id/tasks` ([link](https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/#refactoring-to-use-viewsets)).

0 commit comments

Comments
 (0)