Skip to content

Commit

Permalink
Test: attempt to make test files work again
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritzs committed Mar 27, 2025
1 parent 1abdf65 commit fea717e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jobs:
test:
runs-on: self-hosted

env:
DJANGO_SUPERUSER_USERNAME: admin
DJANGO_SUPERUSER_PASSWORD: Password
DJANGO_SETTINGS_MODULE: secfit.settings

steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
Expand Down
8 changes: 6 additions & 2 deletions backend/tests/test_workout_file_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
class TestWorkoutFileUpload(TestCase):
def setUp(self):
self.client = APIClient()
# Use environment variables if available, otherwise use test defaults
username = os.getenv("DJANGO_SUPERUSER_USERNAME", "admin")
password = os.getenv("DJANGO_SUPERUSER_PASSWORD", "Password") # Not good practice to have the password in the code, should use github secrets

self.user = get_user_model().objects.create_user(
username=os.getenv("DJANGO_SUPERUSER_USERNAME"),
password=os.getenv("DJANGO_SUPERUSER_PASSWORD"),
username=username,
password=password,
)
self.client.force_authenticate(self.user)

Expand Down

0 comments on commit fea717e

Please sign in to comment.