diff --git a/server/config/settings/test.py b/server/config/settings/test.py index 48de7cf6..3a2d0b3d 100644 --- a/server/config/settings/test.py +++ b/server/config/settings/test.py @@ -3,6 +3,10 @@ import os os.environ["IT_APP_ENVIRONMENT"] = "local" +os.environ["AWS_S3_SECRET_ACCESS_KEY"] = os.environ.get( + "AWS_S3_SECRET_ACCESS_KEY", + "!!!default_for_quieting_tests_within_pycharm!!!", +) from .base import * # noqa diff --git a/server/vbv_lernwelt/media_files/tests/test_content_document_serving.py b/server/vbv_lernwelt/media_files/tests/test_content_document_serving.py index 2068e18a..c9cad951 100644 --- a/server/vbv_lernwelt/media_files/tests/test_content_document_serving.py +++ b/server/vbv_lernwelt/media_files/tests/test_content_document_serving.py @@ -1,5 +1,6 @@ import datetime -from unittest import skip +import os +from unittest import skipIf from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase @@ -12,7 +13,10 @@ from vbv_lernwelt.media_files.models import ContentDocument TITLE = "Musterlösung Fahrzeug" -@skip("Those tests useful are to manually test the storage layer.") +@skipIf( + os.environ.get("ENABLE_S3_STORAGE_UNIT_TESTS") is None, + "Only enable tests by setting ENABLE_S3_STORAGE_UNIT_TESTS=1", +) class TestContentDocumentServing(TestCase): def setUp(self): create_default_users() diff --git a/server/vbv_lernwelt/media_files/tests/test_content_document_storage.py b/server/vbv_lernwelt/media_files/tests/test_content_document_storage.py index 00f61549..c1bd849a 100644 --- a/server/vbv_lernwelt/media_files/tests/test_content_document_storage.py +++ b/server/vbv_lernwelt/media_files/tests/test_content_document_storage.py @@ -1,5 +1,6 @@ import datetime -from unittest import skip, skipIf +import os +from unittest import skipIf from django.conf import settings from django.core.files.uploadedfile import SimpleUploadedFile @@ -11,7 +12,10 @@ from vbv_lernwelt.media_files.models import ContentDocument TITLE = "Musterlösung Fahrzeug" -@skip("Those tests useful are to manually test the storage layer.") +@skipIf( + os.environ.get("ENABLE_S3_STORAGE_UNIT_TESTS") is None, + "Only enable tests by setting ENABLE_S3_STORAGE_UNIT_TESTS=1", +) class TestContentDocumentStorage(TestCase): @override_settings(FILE_UPLOAD_STORAGE="s3") def setUp(self):