Skip to content

Commit

Permalink
[staged-updates] adds test for safety check on study creation. Update…
Browse files Browse the repository at this point in the history
…s requirements.
  • Loading branch information
biblicabeebli committed Aug 22, 2024
1 parent dcbaf32 commit a9e1455
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
3 changes: 2 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down
42 changes: 21 additions & 21 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,7 +41,7 @@ certifi==2024.7.4
# pyproj
# requests
# sentry-sdk
cffi==1.16.0
cffi==1.17.0
# via
# soundfile
# timezonefinder
Expand All @@ -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
Expand All @@ -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
Expand All @@ -103,37 +103,37 @@ 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
# google-api-python-client
# 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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions tests/test_study_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit a9e1455

Please sign in to comment.