From a0297498c13c0ab7c0997e425fafb92da15c4cd6 Mon Sep 17 00:00:00 2001 From: Em Sparr Date: Thu, 2 Nov 2023 15:14:59 -0400 Subject: [PATCH 1/8] docs(styling): tries possible option for code output --- README.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b5f9769..ab8c850 100644 --- a/README.md +++ b/README.md @@ -335,11 +335,18 @@ Below are the commands and expected outputs: ```bash pre-commit install -pre-commit installed at .git/hooks/pre-commit +``` +`pre-commit installed at .git/hooks/pre-commit` +```bash pre-commit install --hook-type commit-msg -pre-commit installed at .git/hooks/commit-msg ``` +`pre-commit installed at .git/hooks/commit-msg` + +```bash +pre-commit install --hook-type pre-push +``` +`pre-commit installed at .git/hooks/pre-push` To run the pre-commit checks before making a commit, run the following command. @@ -349,11 +356,9 @@ pre-commit run --all-files If no files need changes, the output should look like this: -```bash -isort....................................................................Passed -black....................................................................Passed -flake8...................................................................Passed -``` +`isort....................................................................Passed` +`black....................................................................Passed` +`flake8...................................................................Passed` If isort or black catch any errors, they will automatically alter the files to fix them. This will prevent making a commit, and you will need to stage the new changes. From e45c5057d4c8783858a1734f5a3f0d34477a3f83 Mon Sep 17 00:00:00 2001 From: Em Sparr Date: Thu, 2 Nov 2023 16:05:28 -0400 Subject: [PATCH 2/8] fix(prepush): reinstalling celery --- Pipfile | 2 +- Pipfile.lock | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Pipfile b/Pipfile index cd8b73b..238d85d 100644 --- a/Pipfile +++ b/Pipfile @@ -24,9 +24,9 @@ sentry-sdk = {extras = ["django"], version = "*"} pytz = "*" redis = "*" coverage = "*" -celery = "*" django-celery-beat = "*" pre-commit = "*" +celery = "*" [dev-packages] flake8 = "*" diff --git a/Pipfile.lock b/Pipfile.lock index ebc02ea..4b90747 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -50,20 +50,20 @@ }, "boto3": { "hashes": [ - "sha256:85e2fa361ad3210d30800bad311688261f2673a9b301e0edab56463d89609761", - "sha256:d18688bc5d688decf3cc404430a3ac3ec317be653cdcfbc51104c01f38a66434" + "sha256:1a47e5b8faea527bb2a40d0cf58faf0d09b5a46cf5658e2c5729479af20c96b8", + "sha256:c0899e54df362bea0ae329da59b0a00e4be5e220e99dc764802ed83cdfc4285c" ], "index": "pypi", "markers": "python_version >= '3.7'", - "version": "==1.28.76" + "version": "==1.28.77" }, "botocore": { "hashes": [ - "sha256:479abb5a1ee03eb00faa1ea176bc595b2f46f7494777807681a9df45ed99ea18", - "sha256:74e0a4515d61b2860b24dc208ca89a68d79dc00147125d531746d3ba808822ad" + "sha256:4c5c9562b5d1fb8355314ddf37142edf3f6abd7526f4a68cc1b6cd79bdda48ec", + "sha256:509168151f8a0e1b8296031a7fc7822d59d027865d3baa86917682b311a74d26" ], "markers": "python_version >= '3.7'", - "version": "==1.31.76" + "version": "==1.31.77" }, "celery": { "hashes": [ @@ -791,7 +791,7 @@ "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.8.2" }, "python3-openid": { @@ -903,10 +903,10 @@ "django" ], "hashes": [ - "sha256:1cce906dc86afda1ecd22c4716b0c846639151a3c3b59e23826711c6525c5642", - "sha256:816aeb900a54bba2d9346bad8ffac2d258c4fa09271b95a6533a714e9000f074" + "sha256:76dd087f38062ac6c1e30ed6feb533ee0037ff9e709974802db7b5dbf2e5db21", + "sha256:e5d0d2b25931d88fa10986da59d941ac6037f742ab6ff2fce4143a27981d60c3" ], - "version": "==1.33.1" + "version": "==1.34.0" }, "setuptools": { "hashes": [ @@ -921,7 +921,7 @@ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.16.0" }, "social-auth-app-django": { From 1504d6fd3b408cf1f0acd635d364404f47a158d3 Mon Sep 17 00:00:00 2001 From: Em Sparr Date: Thu, 2 Nov 2023 16:17:40 -0400 Subject: [PATCH 3/8] fix(precommit): adjusting prepush test run --- .pre-commit-config.yaml | 2 +- scripts/test-run.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 scripts/test-run.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46e572c..458edfe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,7 +40,7 @@ repos: stages: [pre-push] - id: django-test name: 'Checking Tests' - entry: python manage.py test + entry: ./scripts/test-run.sh always_run: true pass_filenames: false language: system diff --git a/scripts/test-run.sh b/scripts/test-run.sh new file mode 100644 index 0000000..6fcc225 --- /dev/null +++ b/scripts/test-run.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +pipenv install +pipenv shell +python manage.py test \ No newline at end of file From 291a3d778dbc938218ba127045d078d1d10f4d8a Mon Sep 17 00:00:00 2001 From: Em Sparr Date: Thu, 2 Nov 2023 16:31:54 -0400 Subject: [PATCH 4/8] fix(prepush): adds shell for running tests --- .pre-commit-config.yaml | 2 +- scripts/test-run.sh | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) mode change 100644 => 100755 scripts/test-run.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 458edfe..aef88e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,7 +40,7 @@ repos: stages: [pre-push] - id: django-test name: 'Checking Tests' - entry: ./scripts/test-run.sh + entry: pipenv run python manage.py test always_run: true pass_filenames: false language: system diff --git a/scripts/test-run.sh b/scripts/test-run.sh old mode 100644 new mode 100755 index 6fcc225..05a7907 --- a/scripts/test-run.sh +++ b/scripts/test-run.sh @@ -1,5 +1,2 @@ #!/bin/bash -pipenv install -pipenv shell -python manage.py test \ No newline at end of file From 69302e02731e13c0c2ee7ce2594830ef044175d6 Mon Sep 17 00:00:00 2001 From: Em Sparr Date: Thu, 2 Nov 2023 16:32:18 -0400 Subject: [PATCH 5/8] chore(linting): clean up --- team_production_system/admin.py | 2 +- .../test_user_profile_patch_upload.py | 21 +++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/team_production_system/admin.py b/team_production_system/admin.py index dd37b1b..0175694 100644 --- a/team_production_system/admin.py +++ b/team_production_system/admin.py @@ -1,5 +1,6 @@ from django.contrib import admin from django.contrib.auth.admin import UserAdmin + from .models import ( Availability, CustomUser, @@ -18,7 +19,6 @@ class SessionAdmin(admin.ModelAdmin): readonly_fields = ('created_at', 'modified_at') -# admin.site.register(UserAdmin) admin.site.register(CustomUser, UserAdmin) admin.site.register(Mentor) admin.site.register(Mentee) diff --git a/team_production_system/tests/end_to_end_tests/test_user_profile_patch_upload.py b/team_production_system/tests/end_to_end_tests/test_user_profile_patch_upload.py index c612378..2ff1b42 100644 --- a/team_production_system/tests/end_to_end_tests/test_user_profile_patch_upload.py +++ b/team_production_system/tests/end_to_end_tests/test_user_profile_patch_upload.py @@ -3,6 +3,7 @@ from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient + from team_production_system.models import CustomUser @@ -10,9 +11,7 @@ class UserProfilePatchTestCase(TestCase): def setUp(self): self.client = APIClient() self.user = CustomUser.objects.create( - username="baby_yoda", - email="grogu@mandalor.edu", - password="badpassword" + username='baby_yoda', email='grogu@mandalor.edu', password='badpassword' ) def test_new_user_gets_random_photo_assigned(self): @@ -22,14 +21,12 @@ def test_new_user_gets_random_photo_assigned(self): def test_profile_photo_uploaded_first_time(self): # mock photo file photo = SimpleUploadedFile( - "photo.jpg", - b"this is a photo", - content_type="image/jpeg" + 'photo.jpg', b'this is a photo', content_type='image/jpeg' ) # Make a PATCH request to update the user profile with the new photo - url = reverse("my-profile") + url = reverse('my-profile') self.client.force_authenticate(user=self.user) - response = self.client.patch(url, {"profile_photo": photo}) + response = self.client.patch(url, {'profile_photo': photo}) # Check that the response status code is 200 OK self.assertEqual(response.status_code, status.HTTP_200_OK) @@ -43,15 +40,13 @@ def test_previous_file_deleted_when_new_photo_saved(self): old_photo_name = self.user.profile_photo.name # Create a new profile photo file new_photo = SimpleUploadedFile( - "new_photo.jpg", - b"this is a new photo", - content_type="image/jpeg" + 'new_photo.jpg', b'this is a new photo', content_type='image/jpeg' ) # Make a PATCH request to update the user profile with the new photo - url = reverse("my-profile") + url = reverse('my-profile') self.client.force_authenticate(user=self.user) - response = self.client.patch(url, {"profile_photo": new_photo}) + response = self.client.patch(url, {'profile_photo': new_photo}) # Check that the response status code is 200 OK self.assertEqual(response.status_code, status.HTTP_200_OK) From 365f33454c3cbaf19f27ee64ef6f4374462df7d9 Mon Sep 17 00:00:00 2001 From: Em Sparr Date: Thu, 2 Nov 2023 16:48:40 -0400 Subject: [PATCH 6/8] chore: remove empty file --- scripts/test-run.sh | 2 -- 1 file changed, 2 deletions(-) delete mode 100755 scripts/test-run.sh diff --git a/scripts/test-run.sh b/scripts/test-run.sh deleted file mode 100755 index 05a7907..0000000 --- a/scripts/test-run.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash - From 12e1b5cd1a6aefab981602c01555537d7685d0b3 Mon Sep 17 00:00:00 2001 From: Em Sparr Date: Thu, 2 Nov 2023 17:22:07 -0400 Subject: [PATCH 7/8] docs: updates name of project --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ab8c850..4b46c65 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Team Production System +# Momentors (Team Production System) -Team Production System is an app for mentees to schedule one-on-one sessions with mentors. +Momentors (Team Production System) is an app for mentees to schedule one-on-one sessions with mentors. ## Quick links: From 046091cad5af588932ef1106ed799dade19bfa87 Mon Sep 17 00:00:00 2001 From: Em Sparr Date: Thu, 2 Nov 2023 17:36:27 -0400 Subject: [PATCH 8/8] docs: remove renaming of app. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b46c65..ab8c850 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Momentors (Team Production System) +# Team Production System -Momentors (Team Production System) is an app for mentees to schedule one-on-one sessions with mentors. +Team Production System is an app for mentees to schedule one-on-one sessions with mentors. ## Quick links: