Enable S3 storage tests by env variable

This commit is contained in:
Daniel Egger 2023-12-19 15:10:26 +01:00
parent 8482a0caa0
commit 799144defd
3 changed files with 16 additions and 4 deletions

View File

@ -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

View File

@ -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()

View File

@ -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):