From 059a4cad5cc41f092cf70236ce4e4066bac7ebe8 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 28 May 2024 15:44:50 +0200 Subject: [PATCH] Add empty user --- env_secrets/caprover_vbv-develop.env | Bin 0 -> 983 bytes .../config/settings/test_cypress_datatrans.py | 46 ++++++++++++++++++ server/vbv_lernwelt/core/constants.py | 1 + .../vbv_lernwelt/core/create_default_users.py | 10 ++++ 4 files changed, 57 insertions(+) create mode 100644 env_secrets/caprover_vbv-develop.env create mode 100644 server/config/settings/test_cypress_datatrans.py diff --git a/env_secrets/caprover_vbv-develop.env b/env_secrets/caprover_vbv-develop.env new file mode 100644 index 0000000000000000000000000000000000000000..613e64d5ea9e4e73af1fbbbc6d17d3f369e9588a GIT binary patch literal 983 zcmV;|11S6eM@dveQdv+`00284w0}u=pyxt84URIkw53qFmm-kFEDi~lHw!r1fB&>{ zIP9PRWrbwq*c+H;(SfZZh%ZjHXZ~y-21@lP&3jE^XEeuXBXnD zs;>RO=-32STb73Q;hA7sVr_SeI^X`89i{DYtlC!gtpsY=J&J|IFEnKJq$a336+$jw zL1SfZV?Zbntu>*$cftu=gCJ-BJ~n8HX0P#IGt5BQgxDkfrg8~BIYNc%7E+|O(|k1U zxPUqdhJ@tNp6HWd0n}qZ`6t3!f%5}PTvbXAot;qs^!Y7;_15feNhyo*%3>9ehc|GA zLvidcB;O{>B!$`4aL@QsSO8#ry-~qE-l{&|HTX~Z1FUMqaq8vm{Q~1kIE51i4)x2u zz7GF;M2~ouS30O_^`rr;^%g)QGH8u`l@j-=cw+Fy%p+7H%ty*dj)_*lcN<>Lq@aWv9;JAkOS5g(>KZ6*6 zPwJYEig{xrF+;JD3XxSxJLuqQbPm5~k1YwvGM+2(8}sbm z%)x5tR#lc8&78$-v3G3vN^!V8T4CW7eZV)jt+2kz#jbZYGt0j=nORjJql}U;OA&DE zi5obGlzmTrsKuY)i?*k+DN30spl5g<-mu(|9Oo}Eo8a&(Y9sA*e3a)sfL{{W)D&20 zhZLYf3J*KDtX^@V!dyND=`Y0Wj3bVq9-rtF{rR1#K}SHq8v=zZgESxa7w<2@ zH1do>&!Nhs&?BwgGVl^)8Pag-~_5 Fgl@^j-h}`F literal 0 HcmV?d00001 diff --git a/server/config/settings/test_cypress_datatrans.py b/server/config/settings/test_cypress_datatrans.py new file mode 100644 index 00000000..fa5fd0f7 --- /dev/null +++ b/server/config/settings/test_cypress_datatrans.py @@ -0,0 +1,46 @@ +# pylint: disable=unused-wildcard-import,wildcard-import,wrong-import-position +import os + +from dotenv import dotenv_values + +script_path = os.path.abspath(__file__) +script_dir = os.path.dirname(script_path) + +dev_env = dotenv_values( + f"{script_dir}/../../../env_secrets/caprover_vbv-develop.env" +) + +os.environ["IT_APP_ENVIRONMENT"] = "local" + +os.environ["AWS_S3_SECRET_ACCESS_KEY"] = dev_env.get("AWS_S3_SECRET_ACCESS_KEY") +os.environ["DATATRANS_BASIC_AUTH_KEY"] = dev_env.get("DATATRANS_BASIC_AUTH_KEY") +os.environ["DATATRANS_HMAC_KEY"] = dev_env.get("DATATRANS_HMAC_KEY") + +from .base import * # noqa + +# GENERAL +# ------------------------------------------------------------------------------ +# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key +DATABASES["default"]["NAME"] = "vbv_lernwelt_cypress" + +# EMAIL +# ------------------------------------------------------------------------------ +# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend +EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend" + +CYPRESS_TEST = True + +# Your stuff... +# ------------------------------------------------------------------------------ +REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] = { + "anon": "10000/day", + "hour-throttle": "40000/hour", + "day-throttle": "2000000/day", +} + +RATELIMIT_ENABLE = False + +# Select faster password hasher during tests +PASSWORD_HASHERS = [ + "django.contrib.auth.hashers.MD5PasswordHasher", +] diff --git a/server/vbv_lernwelt/core/constants.py b/server/vbv_lernwelt/core/constants.py index 9720e557..75f24848 100644 --- a/server/vbv_lernwelt/core/constants.py +++ b/server/vbv_lernwelt/core/constants.py @@ -27,6 +27,7 @@ TEST_STUDENT3_USER_ID = "bcf94dba-53bc-474b-a22d-e4af39aa042b" TEST_MENTOR1_USER_ID = "d1f5f5a9-5b0a-4e1a-9e1a-9e9b5b5e1b1b" TEST_STUDENT1_VV_USER_ID = "5ff59857-8de5-415e-a387-4449f9a0337a" TEST_STUDENT2_VV_AND_VV_MENTOR_USER_ID = "7e8ebf0b-e6e2-4022-88f4-6e663ba0a9db" +TEST_USER_EMPTY_ID = "daecbabe-4ab9-4edf-a71f-4119042ccb02" TEST_COURSE_SESSION_BERN_ID = -1 TEST_COURSE_SESSION_ZURICH_ID = -2 diff --git a/server/vbv_lernwelt/core/create_default_users.py b/server/vbv_lernwelt/core/create_default_users.py index e9b8aba8..fbbaba8d 100644 --- a/server/vbv_lernwelt/core/create_default_users.py +++ b/server/vbv_lernwelt/core/create_default_users.py @@ -20,6 +20,7 @@ from vbv_lernwelt.core.constants import ( TEST_SUPERVISOR1_USER_ID, TEST_TRAINER1_USER_ID, TEST_TRAINER2_USER_ID, + TEST_USER_EMPTY_ID, ) from vbv_lernwelt.core.models import User @@ -192,6 +193,15 @@ def create_default_users(default_password="test", set_avatar=False): password=env("IT_DEFAULT_ADMIN_PASSWORD", default_password), ) + _create_user( + TEST_USER_EMPTY_ID, + "empty@example.com", + "Flasche", + "Leer", + password=default_password, + language="de", + ) + for user_data in default_users: _create_student_user(**user_data)