63 lines
1.5 KiB
Python
63 lines
1.5 KiB
Python
"""Integration tests for functions exposed by the datastore module."""
|
|
|
|
import os
|
|
|
|
import pytest
|
|
from minio import Minio
|
|
from testcontainers.minio import MinioContainer
|
|
|
|
from shared.datastore import connect_minio
|
|
|
|
minio = MinioContainer()
|
|
MINIO_BUCKET_NAME = 'visual-critical-discourse-analysis'
|
|
|
|
|
|
@pytest.fixture(scope='module', autouse=True)
|
|
def setup(request):
|
|
"""Setup function for datastore module integration tests."""
|
|
# start minio
|
|
minio.start()
|
|
|
|
# ensure minio is stopped after testing
|
|
def remove_container():
|
|
minio.stop()
|
|
|
|
request.addfinalizer(remove_container)
|
|
# extract information
|
|
minio_ip = minio.get_container_host_ip()
|
|
minio_port = minio.get_exposed_port(port=9000)
|
|
os.environ['MINIO_ENDPOINT'] = f'{minio_ip}:{minio_port}'
|
|
os.environ['MINIO_ACCESS_KEY'] = minio.access_key
|
|
os.environ['MINIO_SECRET_KEY'] = minio.secret_key
|
|
os.environ['MINIO_BUCKET_NAME'] = MINIO_BUCKET_NAME
|
|
# save random image to Minio
|
|
pass
|
|
# save random model to Minio
|
|
pass
|
|
|
|
|
|
def test_connect_minio():
|
|
"""Test function connect_minio."""
|
|
minio_client = connect_minio()
|
|
assert isinstance(minio_client, Minio)
|
|
|
|
|
|
def test_get_image():
|
|
"""Test function get_image."""
|
|
raise NotImplementedError()
|
|
|
|
|
|
def test_put_image():
|
|
"""Test function put_image."""
|
|
raise NotImplementedError()
|
|
|
|
|
|
def test_get_model():
|
|
"""Test function get_model."""
|
|
raise NotImplementedError()
|
|
|
|
|
|
def test_put_model():
|
|
"""Test function put_model."""
|
|
raise NotImplementedError()
|