From 2f713e32186eb761bca485bda384ccee9a1199ce Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 12:29:46 -0800 Subject: [PATCH 01/13] added account tests --- .github/workflows/tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d14ae98..ea37e7e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,9 +35,16 @@ jobs: cd ScheduleBuilder pip install -r requirements.txt - - name: Run Tests + - name: Run Google Calendar Tests env: CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com run: | cd ScheduleBuilder/google_calendar pytest test.py + + - name: Run Account Tests + env: + CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com + run: | + cd ScheduleBuilder/account + pytest regtests.py From a13573d625b1c569ff348960d593bb92256cdcb9 Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 12:31:10 -0800 Subject: [PATCH 02/13] added COV branch for on --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ea37e7e..eef63a3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,11 +4,11 @@ on: push: branches: - main - - tidyup + - COV pull_request: branches: - main - - tidyup + - COV jobs: install: From 7d70e5ac46b4e717435f7c60772168c20d2354b9 Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 12:33:47 -0800 Subject: [PATCH 03/13] added migration commands to account tests --- .github/workflows/tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eef63a3..6d200a3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,5 +46,8 @@ jobs: env: CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com run: | - cd ScheduleBuilder/account + cd ScheduleBuilder + python manage.py makemigrations + python manage.py migrate + cd account pytest regtests.py From 5195d46905333015484226e72fd6697b41487ec7 Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 16:34:05 -0800 Subject: [PATCH 04/13] included account tests in coverage report --- .github/workflows/coverage.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7e84fa8..261cb13 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -3,11 +3,11 @@ on: push: branches: - main - - tidyup + - COV pull_request: branches: - main - - tidyup + - COV jobs: install: @@ -34,12 +34,28 @@ jobs: cd ScheduleBuilder pip install -r requirements.txt - - name: Run Tests with Coverage + - name: Run Google Calendar Tests with Coverage env: CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com run: | - cd ScheduleBuilder/google_calendar + cd ScheduleBuilder + python manage.py makemigrations + python manage.py migrate + cd account + pytest --cov=./ --cov-report=xml regtests.py + + - name: Run Account Tests with Coverage + env: + CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com + run: | + cd ScheduleBuilder/account pytest --cov=./ --cov-report=xml test.py + + - name: Combine Coverage Reports + run: | + cd ScheduleBuilder + coverage combine google_calendar/coverage.xml account/coverage.xml + coverage xml -o combined_coverage.xml - name: Upload Coverage to Codecov uses: codecov/codecov-action@v3 @@ -47,5 +63,5 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./ScheduleBuilder/google_calendar/coverage.xml + files: ./ScheduleBuilder/combined_coverage.xml fail_ci_if_error: true From a2351cec6119d29ab964314ffe7507004bdab19d Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 16:37:31 -0800 Subject: [PATCH 05/13] updated regtests.py path --- .github/workflows/coverage.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 261cb13..e049f77 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -35,6 +35,14 @@ jobs: pip install -r requirements.txt - name: Run Google Calendar Tests with Coverage + env: + CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com + run: | + cd ScheduleBuilder/google_calendar + pytest --cov=./ --cov-report=xml test.py + + + - name: Run Account Tests with Coverage env: CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com run: | @@ -44,12 +52,6 @@ jobs: cd account pytest --cov=./ --cov-report=xml regtests.py - - name: Run Account Tests with Coverage - env: - CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com - run: | - cd ScheduleBuilder/account - pytest --cov=./ --cov-report=xml test.py - name: Combine Coverage Reports run: | From 325ca3c27fd7e3ca7231aef086fd00acfd889d1f Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 16:40:51 -0800 Subject: [PATCH 06/13] removed preformatting of coverage reports --- .github/workflows/coverage.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e049f77..9cc0dd4 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -39,7 +39,7 @@ jobs: CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com run: | cd ScheduleBuilder/google_calendar - pytest --cov=./ --cov-report=xml test.py + pytest --cov=./ test.py - name: Run Account Tests with Coverage @@ -50,13 +50,13 @@ jobs: python manage.py makemigrations python manage.py migrate cd account - pytest --cov=./ --cov-report=xml regtests.py + pytest --cov=./ regtests.py - name: Combine Coverage Reports run: | cd ScheduleBuilder - coverage combine google_calendar/coverage.xml account/coverage.xml + coverage combine google_calendar/.coverage account/.coverage coverage xml -o combined_coverage.xml - name: Upload Coverage to Codecov From b6f56689ff91302755316f8b37653bb76a69a5aa Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 16:47:39 -0800 Subject: [PATCH 07/13] included badges in sprint 3 history --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd69a4f..494e890 100644 --- a/README.md +++ b/README.md @@ -76,4 +76,8 @@ Then go to the browser and enter the url **http://127.0.0.1:8000/** - Remove friends - Add friends to events * PyTest - - Implementated unit tests for google calendar + - Implementated unit tests for google calendar and accounts +* CI/CD + - Django build badge + - Django tests badge + - Test coverage badge From 1fbcb7e7b0cbdaf346b3dbb6510ed687ad12b688 Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 22:37:15 -0800 Subject: [PATCH 08/13] removed google_calendar tests --- .github/workflows/coverage.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 9cc0dd4..d79e33a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -3,11 +3,11 @@ on: push: branches: - main - - COV + - coverage pull_request: branches: - main - - COV + - coverage jobs: install: @@ -34,14 +34,6 @@ jobs: cd ScheduleBuilder pip install -r requirements.txt - - name: Run Google Calendar Tests with Coverage - env: - CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com - run: | - cd ScheduleBuilder/google_calendar - pytest --cov=./ test.py - - - name: Run Account Tests with Coverage env: CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com @@ -53,11 +45,11 @@ jobs: pytest --cov=./ regtests.py - - name: Combine Coverage Reports + - name: Create Coverage Report run: | cd ScheduleBuilder - coverage combine google_calendar/.coverage account/.coverage - coverage xml -o combined_coverage.xml + coverage combine account/.coverage + coverage xml -o coverage.xml - name: Upload Coverage to Codecov uses: codecov/codecov-action@v3 @@ -65,5 +57,5 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./ScheduleBuilder/combined_coverage.xml + files: ./ScheduleBuilder/coverage.xml fail_ci_if_error: true From e6e3a0b0c07cd423a3208f4c7db1dac164810075 Mon Sep 17 00:00:00 2001 From: Jacob Dodson <32625153+jcdodson@users.noreply.github.com> Date: Sun, 10 Dec 2023 22:37:56 -0800 Subject: [PATCH 09/13] removed calendar tests --- .github/workflows/tests.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6d200a3..caa3ef3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,11 +4,11 @@ on: push: branches: - main - - COV + - coverage pull_request: branches: - main - - COV + - coverage jobs: install: @@ -34,13 +34,6 @@ jobs: run: | cd ScheduleBuilder pip install -r requirements.txt - - - name: Run Google Calendar Tests - env: - CAL_ID: c_6ed17073345c64d5b392f5a8ef7b4a62938f12c8fc5fecfa4b7256ef88acad28@group.calendar.google.com - run: | - cd ScheduleBuilder/google_calendar - pytest test.py - name: Run Account Tests env: From 0fb35f2f961dd573ad9d040c8f916a17a00dc56d Mon Sep 17 00:00:00 2001 From: tesss24 <102249475+tesss24@users.noreply.github.com> Date: Sun, 10 Dec 2023 22:45:57 -0800 Subject: [PATCH 10/13] Update test.py --- ScheduleBuilder/google_calendar/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ScheduleBuilder/google_calendar/test.py b/ScheduleBuilder/google_calendar/test.py index 1798805..a052abd 100644 --- a/ScheduleBuilder/google_calendar/test.py +++ b/ScheduleBuilder/google_calendar/test.py @@ -1,5 +1,5 @@ from google_calendar.views import * -from account.views import * +from profile.views import * from django.urls import reverse from django.test import Client from unittest.mock import Mock, patch From a7b3f3fc58ee04d08a575d845df2d632d01bc919 Mon Sep 17 00:00:00 2001 From: tesss24 <102249475+tesss24@users.noreply.github.com> Date: Sun, 10 Dec 2023 22:47:36 -0800 Subject: [PATCH 11/13] Update regtests.py --- ScheduleBuilder/account/regtests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ScheduleBuilder/account/regtests.py b/ScheduleBuilder/account/regtests.py index 5633fbd..febebd5 100644 --- a/ScheduleBuilder/account/regtests.py +++ b/ScheduleBuilder/account/regtests.py @@ -7,7 +7,7 @@ from django.test import Client from unittest.mock import Mock, patch import requests -from account.models import * +from profile.models import * @pytest.mark.django_db def test_create_user(): @@ -100,4 +100,4 @@ def test_create_user_no_username_sad(): username='', # Empty username should raise ValueError password='testpassword', ) - print(f"Exception message: {e}") \ No newline at end of file + print(f"Exception message: {e}") From 61fd80b44e9ae0b1366bcfdd57fdaae1d040bcc1 Mon Sep 17 00:00:00 2001 From: tesss24 <102249475+tesss24@users.noreply.github.com> Date: Sun, 10 Dec 2023 22:55:44 -0800 Subject: [PATCH 12/13] Unupdate test.py --- ScheduleBuilder/google_calendar/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ScheduleBuilder/google_calendar/test.py b/ScheduleBuilder/google_calendar/test.py index a052abd..1798805 100644 --- a/ScheduleBuilder/google_calendar/test.py +++ b/ScheduleBuilder/google_calendar/test.py @@ -1,5 +1,5 @@ from google_calendar.views import * -from profile.views import * +from account.views import * from django.urls import reverse from django.test import Client from unittest.mock import Mock, patch From 784187f3523871c6a3bec52884b1f1ffc8ae45ea Mon Sep 17 00:00:00 2001 From: tesss24 <102249475+tesss24@users.noreply.github.com> Date: Sun, 10 Dec 2023 22:56:07 -0800 Subject: [PATCH 13/13] Unupdate regtests.py --- ScheduleBuilder/account/regtests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ScheduleBuilder/account/regtests.py b/ScheduleBuilder/account/regtests.py index febebd5..d2c364c 100644 --- a/ScheduleBuilder/account/regtests.py +++ b/ScheduleBuilder/account/regtests.py @@ -7,7 +7,7 @@ from django.test import Client from unittest.mock import Mock, patch import requests -from profile.models import * +from account.models import * @pytest.mark.django_db def test_create_user():