I use django-minio-backend in order to integrate Django and Minio.
I want to create a test bucket for created media files during tests running.
I tried to do that in a custom test runner as follows:
class CoreTestRunner(DiscoverRunner):
def setup_test_environment(self, **kwargs):
super(CoreTestRunner, self).setup_test_environment()
self._make_test_file_storage()
def _make_test_file_storage(self):
minio_test_bucket = "test-bucket"
settings.MINIO_MEDIA_FILES_BUCKET = minio_test_bucket
settings.MINIO_PRIVATE_BUCKETS = [minio_test_bucket]
call_command("initialize_buckets")
The problem is that when I run the test command, Minio creates the test-bucket, but uploads all files to the old bucket (the available bucket before creating test-bucket)
The old bucket in settings.py is project-media-bucket and all the files are uploaded in this bucket instead of uploading on test-bucket.
How can I solve the problem?