Skip to content

Commit

Permalink
Fix automated tests (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei authored Mar 28, 2024
1 parent 9480ab9 commit 2547543
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/api_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ jobs:
tests:
name: Run backend tests
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16.2
env:
POSTGRES_DB: seismic
POSTGRES_USER: user
POSTGRES_PASSWORD: password
ports:
- 5432:5432

steps:
- name: Check out Git repository
uses: actions/checkout@v4
Expand All @@ -110,5 +121,18 @@ jobs:
pip install -r ./backend/requirements-dev.txt
- name: Run tests
env:
ENVIRONMENT: "test"
DJANGO_SETTINGS_MODULE: "seismic_site.settings"
DEBUG: "True"
SECRET_KEY: "test_secret"
SITE_URL: "http://localhost"
EMAIL_BACKEND: "django.core.mail.backends.dummy.EmailBackend"
TEST_RUNNER: "tests.runner.PytestTestRunner"
DATABASE_NAME: seismic
DATABASE_USER: user
DATABASE_PASSWORD: password
DATABASE_HOST: postgres
DATABASE_PORT: 5432
run: |
ENVIRONMENT=test DJANGO_SETTINGS_MODULE=seismic_site.test_settings ./backend/manage.py test
./backend/manage.py test
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ max-complexity = 10
"*/__init__.py" = ["F401"]

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "backend.test_settings"
DJANGO_SETTINGS_MODULE = "seismic_site.settings"

python_files = [
"test.py",
Expand Down
2 changes: 1 addition & 1 deletion backend/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[pytest]
DJANGO_SETTINGS_MODULE = seismic_site.test_settings
DJANGO_SETTINGS_MODULE = seismic_site.settings
ENVIRONMENT = test
9 changes: 0 additions & 9 deletions backend/seismic_site/test_settings.py

This file was deleted.

0 comments on commit 2547543

Please sign in to comment.