From 2d5f13d574c53a127b7ef70abc94ae6b3fbc408d Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 17:45:18 -0400 Subject: [PATCH 01/10] feat(tests): setup test action --- .github/workflows/python-tests.yml | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/python-tests.yml diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 0000000..c7fe469 --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -0,0 +1,31 @@ +name: Python Tests + +on: + pull_request: + branches: + - staging + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.10] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + + - name: Run tests with pytest + run: | + pytest From f474ff7090a2f25f3949263f217d9c1be29cbd25 Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 17:48:44 -0400 Subject: [PATCH 02/10] feat(tests): setup test action fix --- .github/workflows/python-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index c7fe469..0e7734a 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - python-version: [3.10] + python-version: ['3.10'] steps: - uses: actions/checkout@v2 From a03c5a429e3d632a2172d62d00315d72e2e807bc Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 17:52:33 -0400 Subject: [PATCH 03/10] feat(tests): setup test action fix --- .github/workflows/python-tests.yml | 3 +- requirements.txt | 86 ++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 0e7734a..5e2fdef 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -25,7 +25,8 @@ jobs: run: | python -m pip install --upgrade pip pip install pytest + pip install -r requirements.txt - name: Run tests with pytest run: | - pytest + pytest \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6714c3b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,86 @@ +amqp==5.1.1 +asgiref==3.7.2 +async-timeout==4.0.3 +autopep8==2.0.1 +billiard==4.1.0 +boto3==1.28.57 +botocore==1.31.57 +celery==5.3.4 +certifi==2023.7.22 +cffi==1.16.0 +cfgv==3.4.0 +charset-normalizer==3.3.0 +click==8.1.7 +click-didyoumean==0.3.0 +click-plugins==1.1.1 +click-repl==0.3.0 +coreapi==2.3.3 +coreschema==0.0.4 +coverage==7.3.1 +cron-descriptor==1.4.0 +cryptography==41.0.4 +defusedxml==0.8.0rc2 +distlib==0.3.7 +Django==4.2.5 +django-appconf==1.0.5 +django-celery-beat==2.5.0 +django-cors-headers==4.2.0 +django-environ==0.11.2 +django-extensions==3.2.3 +django-imagekit==5.0.0 +django-multiselectfield==0.1.12 +django-phonenumber-field==7.1.0 +django-storages==1.14.1 +django-templated-mail==1.1.1 +django-timezone-field==6.0.1 +djangorestframework==3.14.0 +djangorestframework-simplejwt==5.3.0 +djoser==2.2.0 +filelock==3.12.4 +flake8==6.1.0 +gunicorn==21.2.0 +identify==2.5.30 +idna==3.4 +itypes==1.2.0 +Jinja2==3.1.2 +jmespath==1.0.1 +kombu==5.3.2 +MarkupSafe==2.1.2 +mccabe==0.7.0 +nodeenv==1.8.0 +oauthlib==3.2.2 +packaging==23.2 +phonenumbers==8.13.22 +pilkit==3.0 +Pillow==10.0.1 +platformdirs==3.10.0 +pre-commit==3.4.0 +prompt-toolkit==3.0.39 +psycopg2-binary==2.9.8 +pycodestyle==2.11.0 +pycparser==2.21 +pyflakes==3.1.0 +PyJWT==2.8.0 +python-crontab==3.0.0 +python-dateutil==2.8.2 +python3-openid==3.2.0 +pytz==2023.3.post1 +PyYAML==6.0.1 +redis==5.0.1 +requests==2.31.0 +requests-oauthlib==1.3.1 +s3transfer==0.7.0 +sentry-sdk==1.31.0 +six==1.16.0 +social-auth-app-django==5.3.0 +social-auth-core==4.4.2 +sqlparse==0.4.4 +tomli==2.0.1 +typing_extensions==4.8.0 +tzdata==2023.3 +uritemplate==4.1.1 +urllib3==1.26.16 +vine==5.0.0 +virtualenv==20.24.5 +wcwidth==0.2.8 +whitenoise==6.5.0 From 63316ec5e65a3b4a68f0756866a9cded0762dc2e Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 17:58:13 -0400 Subject: [PATCH 04/10] feat(tests): setup test action fix --- .github/workflows/python-tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 5e2fdef..f046e62 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -14,6 +14,7 @@ jobs: python-version: ['3.10'] steps: + - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -27,6 +28,9 @@ jobs: pip install pytest pip install -r requirements.txt + - name: Set DJANGO_SETTINGS_MODULE environment variable + run: echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV + - name: Run tests with pytest run: | - pytest \ No newline at end of file + pytest From 849ea722c0be56aea193c754645eba08da1ad060 Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 18:09:10 -0400 Subject: [PATCH 05/10] feat(tests): setup test action fix --- .github/workflows/python-tests.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index f046e62..c1afb77 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -14,7 +14,6 @@ jobs: python-version: ['3.10'] steps: - - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -29,8 +28,10 @@ jobs: pip install -r requirements.txt - name: Set DJANGO_SETTINGS_MODULE environment variable - run: echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV + run: + echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV - name: Run tests with pytest - run: | - pytest + run: pytest + env: + SECRET_KEY: ${{ secrets.SECRET_KEY }} From 4d744cd634b41f2ac2566032aa8f06d2800ec19a Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 18:20:22 -0400 Subject: [PATCH 06/10] feat(tests): setup test action fix --- .github/workflows/python-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index c1afb77..4bbd85c 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -35,3 +35,7 @@ jobs: run: pytest env: SECRET_KEY: ${{ secrets.SECRET_KEY }} + DATABASE_URL: ${{ secrets.DATABASE_URL }} + + - name: Debug environment variables + run: echo $DATABASE_URL | awk '{print substr($0, 1, 4)}' From c46c73f377b18f8e23fa65e01a845455c91a48e2 Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 18:30:08 -0400 Subject: [PATCH 07/10] feat(tests): setup test action fix --- .github/workflows/python-tests.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 4bbd85c..49efdaa 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - python-version: ['3.10'] + python-version: ["3.10"] steps: - uses: actions/checkout@v2 @@ -28,14 +28,21 @@ jobs: pip install -r requirements.txt - name: Set DJANGO_SETTINGS_MODULE environment variable - run: - echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV + run: echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV - name: Run tests with pytest run: pytest env: SECRET_KEY: ${{ secrets.SECRET_KEY }} DATABASE_URL: ${{ secrets.DATABASE_URL }} - - - name: Debug environment variables - run: echo $DATABASE_URL | awk '{print substr($0, 1, 4)}' + DEBUG: ${{ secrets.DEBUG }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }} + EMAIL_HOST: ${{ secrets.EMAIL_HOST }} + EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }} + EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }} + SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + CELERY_BROKER_URL: ${{ secrets.CELERY_BROKER_URL }} + CELERY_RESULT_BACKEND: ${{ secrets.CELERY_RESULT_BACKEND }} + CELERY_TIMEZONE: ${{ secrets.CELERY_TIMEZONE }} From 14c90b8cd10cded67aba65304de34efd560eaec4 Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 18:33:49 -0400 Subject: [PATCH 08/10] feat(tests): setup test action fix --- .../tests/unit_tests/models/test_mentor_model.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/team_production_system/tests/unit_tests/models/test_mentor_model.py b/team_production_system/tests/unit_tests/models/test_mentor_model.py index 8f7fd34..66e464d 100644 --- a/team_production_system/tests/unit_tests/models/test_mentor_model.py +++ b/team_production_system/tests/unit_tests/models/test_mentor_model.py @@ -5,7 +5,6 @@ class MentorModelTest(TestCase): def setUp(self): - # Assuming CustomUser has a username and password self.user = CustomUser.objects.create(username='testuser', password='password123') @@ -17,8 +16,6 @@ def test_mentor_creation(self): skills=['HTML', 'CSS', 'Django'] ) - # Assert that the mentor object was saved and has the correct - # attributes self.assertEqual(mentor.about_me, 'This is a test about me.') self.assertEqual(mentor.team_number, 5) self.assertListEqual(list(mentor.skills), ['HTML', 'CSS', 'Django']) @@ -31,25 +28,20 @@ def test_str_representation(self): skills=['HTML'] ) - # Assert that the __str__ method returns the correct representation self.assertEqual(str(mentor), 'testuser') def test_default_about_me(self): - # Create a Mentor object without specifying an 'about_me' mentor = Mentor.objects.create( user=self.user, skills=['HTML'] ) - # Assert that the default value for 'about_me' is set self.assertEqual(mentor.about_me, '') def test_default_team_number(self): - # Create a Mentor object without specifying a 'team_number' mentor = Mentor.objects.create( user=self.user, skills=['HTML'] ) - # Assert that the default value for 'team_number' is set self.assertEqual(mentor.team_number, 0) From 74a5cd2e297179024d8e0f5dfc389c81603d5a98 Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 18:42:56 -0400 Subject: [PATCH 09/10] feat(tests): setup test action fix --- .github/workflows/python-tests.yml | 96 +++++++++++++++--------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 49efdaa..fdc515d 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -1,48 +1,48 @@ -name: Python Tests - -on: - pull_request: - branches: - - staging - -jobs: - test: - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: ["3.10"] - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - pip install -r requirements.txt - - - name: Set DJANGO_SETTINGS_MODULE environment variable - run: echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV - - - name: Run tests with pytest - run: pytest - env: - SECRET_KEY: ${{ secrets.SECRET_KEY }} - DATABASE_URL: ${{ secrets.DATABASE_URL }} - DEBUG: ${{ secrets.DEBUG }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }} - EMAIL_HOST: ${{ secrets.EMAIL_HOST }} - EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }} - EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }} - SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - CELERY_BROKER_URL: ${{ secrets.CELERY_BROKER_URL }} - CELERY_RESULT_BACKEND: ${{ secrets.CELERY_RESULT_BACKEND }} - CELERY_TIMEZONE: ${{ secrets.CELERY_TIMEZONE }} +# name: Python Tests + +# on: +# pull_request: +# branches: +# - staging + +# jobs: +# test: +# runs-on: ubuntu-latest + +# strategy: +# matrix: +# python-version: ["3.10"] + +# steps: +# - uses: actions/checkout@v2 + +# - name: Set up Python ${{ matrix.python-version }} +# uses: actions/setup-python@v2 +# with: +# python-version: ${{ matrix.python-version }} + +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install pytest +# pip install -r requirements.txt + +# - name: Set DJANGO_SETTINGS_MODULE environment variable +# run: echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV + +# - name: Run tests with pytest +# run: pytest +# env: +# SECRET_KEY: ${{ secrets.SECRET_KEY }} +# DATABASE_URL: ${{ secrets.DATABASE_URL }} +# DEBUG: ${{ secrets.DEBUG }} +# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} +# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} +# AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }} +# EMAIL_HOST: ${{ secrets.EMAIL_HOST }} +# EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }} +# EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }} +# SENTRY_DSN: ${{ secrets.SENTRY_DSN }} +# CELERY_BROKER_URL: ${{ secrets.CELERY_BROKER_URL }} +# CELERY_RESULT_BACKEND: ${{ secrets.CELERY_RESULT_BACKEND }} +# CELERY_TIMEZONE: ${{ secrets.CELERY_TIMEZONE }} From c06428796e682b60fed06815b0f1f3ef21613052 Mon Sep 17 00:00:00 2001 From: GitLukeW Date: Sat, 7 Oct 2023 18:57:38 -0400 Subject: [PATCH 10/10] feat(tests): setup test action fix --- .github/workflows/python-tests.yml | 102 +++++++++++++++-------------- 1 file changed, 54 insertions(+), 48 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index fdc515d..6d9991c 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -1,48 +1,54 @@ -# name: Python Tests - -# on: -# pull_request: -# branches: -# - staging - -# jobs: -# test: -# runs-on: ubuntu-latest - -# strategy: -# matrix: -# python-version: ["3.10"] - -# steps: -# - uses: actions/checkout@v2 - -# - name: Set up Python ${{ matrix.python-version }} -# uses: actions/setup-python@v2 -# with: -# python-version: ${{ matrix.python-version }} - -# - name: Install dependencies -# run: | -# python -m pip install --upgrade pip -# pip install pytest -# pip install -r requirements.txt - -# - name: Set DJANGO_SETTINGS_MODULE environment variable -# run: echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV - -# - name: Run tests with pytest -# run: pytest -# env: -# SECRET_KEY: ${{ secrets.SECRET_KEY }} -# DATABASE_URL: ${{ secrets.DATABASE_URL }} -# DEBUG: ${{ secrets.DEBUG }} -# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} -# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} -# AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }} -# EMAIL_HOST: ${{ secrets.EMAIL_HOST }} -# EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }} -# EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }} -# SENTRY_DSN: ${{ secrets.SENTRY_DSN }} -# CELERY_BROKER_URL: ${{ secrets.CELERY_BROKER_URL }} -# CELERY_RESULT_BACKEND: ${{ secrets.CELERY_RESULT_BACKEND }} -# CELERY_TIMEZONE: ${{ secrets.CELERY_TIMEZONE }} +name: Python Tests + +on: + pull_request: + branches: + - staging + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ["3.10"] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: switch to branch + run: git checkout ${{ github.event.pull_request.head.ref }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + pip install -r requirements.txt + + - name: Set DJANGO_SETTINGS_MODULE environment variable + run: echo "DJANGO_SETTINGS_MODULE=config.settings" >> $GITHUB_ENV + + - name: Run tests with pytest + run: pytest + env: + SECRET_KEY: ${{ secrets.SECRET_KEY }} + DATABASE_URL: ${{ secrets.DATABASE_URL }} + DEBUG: ${{ secrets.DEBUG }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }} + EMAIL_HOST: ${{ secrets.EMAIL_HOST }} + EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }} + EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }} + SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + CELERY_BROKER_URL: ${{ secrets.CELERY_BROKER_URL }} + CELERY_RESULT_BACKEND: ${{ secrets.CELERY_RESULT_BACKEND }} + CELERY_TIMEZONE: ${{ secrets.CELERY_TIMEZONE }}