From a9e14550d9172380c9e5e64bf31242fb9f4e4e0d Mon Sep 17 00:00:00 2001 From: Eli Jones Date: Thu, 22 Aug 2024 03:37:32 -0400 Subject: [PATCH] [staged-updates] adds test for safety check on study creation. Updates requirements. --- requirements.in | 3 ++- requirements.txt | 42 +++++++++++++++++------------------ tests/test_study_endpoints.py | 11 +++++++++ 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/requirements.in b/requirements.in index b5208b6cf..d54fc5c94 100644 --- a/requirements.in +++ b/requirements.in @@ -1,5 +1,6 @@ # core libraries -Django==4.2.14 +Django>=4.2.14 +Django<=5.0.0 firebase-admin==5.4.0 Jinja2 # used to require pinning, I guess review if there is a major version bump. zstd>=1.5.5.1 # can be stuck on older versions sometimes diff --git a/requirements.txt b/requirements.txt index 581951c1a..7c749967d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,15 +24,15 @@ billiard==4.2.0 # via celery bleach==6.1.0 # via -r requirements.in -boto3==1.34.144 +boto3==1.35.3 # via -r requirements.in -botocore==1.34.144 +botocore==1.35.3 # via # boto3 # s3transfer cachecontrol==0.14.0 # via firebase-admin -cachetools==5.4.0 +cachetools==5.5.0 # via google-auth celery==5.4.0 # via -r requirements.in @@ -41,7 +41,7 @@ certifi==2024.7.4 # pyproj # requests # sentry-sdk -cffi==1.16.0 +cffi==1.17.0 # via # soundfile # timezonefinder @@ -65,7 +65,7 @@ decorator==5.1.1 # via # ipython # librosa -django==4.2.14 +django==4.2.15 # via # -r requirements.in # django-extensions @@ -87,9 +87,9 @@ google-api-core[grpc]==2.19.1 # google-cloud-core # google-cloud-firestore # google-cloud-storage -google-api-python-client==2.137.0 +google-api-python-client==2.142.0 # via firebase-admin -google-auth==2.32.0 +google-auth==2.34.0 # via # google-api-core # google-api-python-client @@ -103,29 +103,29 @@ google-cloud-core==2.4.1 # via # google-cloud-firestore # google-cloud-storage -google-cloud-firestore==2.16.1 +google-cloud-firestore==2.17.2 # via firebase-admin -google-cloud-storage==2.17.0 +google-cloud-storage==2.18.2 # via firebase-admin google-crc32c==1.5.0 # via # google-cloud-storage # google-resumable-media -google-resumable-media==2.7.1 +google-resumable-media==2.7.2 # via google-cloud-storage googleapis-common-protos==1.63.2 # via # google-api-core # grpcio-status -grpcio==1.64.1 +grpcio==1.65.5 # via # google-api-core # grpcio-status -grpcio-status==1.62.2 +grpcio-status==1.65.5 # via google-api-core h3==3.7.7 # via timezonefinder -holidays==0.53 +holidays==0.55 # via forest httplib2==0.22.0 # via @@ -133,7 +133,7 @@ httplib2==0.22.0 # google-auth-httplib2 idna==3.7 # via requests -importlib-metadata==8.0.0 +importlib-metadata==8.4.0 # via numba ipython==8.12.3 # via -r requirements.in @@ -149,7 +149,7 @@ joblib==1.4.2 # via # librosa # scikit-learn -kombu==5.3.7 +kombu==5.4.0 # via celery lazy-loader==0.4 # via librosa @@ -209,7 +209,7 @@ proto-plus==1.24.0 # via # google-api-core # google-cloud-firestore -protobuf==4.25.3 +protobuf==5.27.3 # via # google-api-core # google-cloud-firestore @@ -220,7 +220,7 @@ psycopg==3.2.1 # via -r requirements.in ptyprocess==0.7.0 # via pexpect -pure-eval==0.2.2 +pure-eval==0.2.3 # via stack-data pyasn1==0.6.0 # via @@ -278,9 +278,9 @@ scipy==1.10.1 # librosa # scikit-learn # ssqueezepy -sentry-sdk==2.10.0 +sentry-sdk==2.13.0 # via cronutils -shapely==2.0.5 +shapely==2.0.6 # via forest six==1.16.0 # via @@ -335,9 +335,9 @@ wcwidth==0.2.13 # via prompt-toolkit webencodings==0.5.1 # via bleach -wheel==0.43.0 +wheel==0.44.0 # via forest -zipp==3.19.2 +zipp==3.20.0 # via importlib-metadata zstd==1.5.5.1 # via -r requirements.in diff --git a/tests/test_study_endpoints.py b/tests/test_study_endpoints.py index 1d93c8f83..ce75b5124 100644 --- a/tests/test_study_endpoints.py +++ b/tests/test_study_endpoints.py @@ -363,6 +363,17 @@ def test_create_study_bad_name(self): resp = self.smart_post_status_code(302, **params) self.assert_present(resp.content, b"you provided contained unsafe characters") self.assert_no_new_study + + def create_study_with_too_much_whitespace_gets_normalized(self): + self.set_session_study_relation(ResearcherRole.site_admin) + params = self.create_study_params() + params["name"] = "name hello" + resp = self.smart_post_status_code(302, **params) + self.assertEqual(resp.url, easy_url("study_endpoints.create_study")) + self.assert_not_present( + resp.content, b"the study name you provided was too long and was rejected" + ) + self.assertIsNotNone(Study.objects.get(name="name hello")) # ok this will crash class TestHideStudy(ResearcherSessionTest):