mirror of
https://github.com/bec-project/bec_atlas.git
synced 2025-07-14 15:01:48 +02:00
fix: update settings for asyncio testing
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
from unittest import mock
|
||||
@ -14,6 +15,11 @@ from bec_atlas.main import AtlasApp
|
||||
from bec_atlas.router.redis_router import BECAsyncRedisManager
|
||||
|
||||
|
||||
class TestRedis(fakeredis.FakeAsyncRedis):
|
||||
async def execute_command(self, *args, **options):
|
||||
return await asyncio.shield(super().execute_command(*args, **options))
|
||||
|
||||
|
||||
def import_mongodb_data(mongo_client: pymongo.MongoClient):
|
||||
"""
|
||||
Import the test data into the mongodb container. The data is stored in the
|
||||
@ -86,9 +92,7 @@ def backend(redis_server):
|
||||
return fakeredis.FakeStrictRedis(server=redis_server)
|
||||
|
||||
mongo_client = mongomock.MongoClient("localhost", 27027)
|
||||
fake_async_redis = fakeredis.FakeAsyncRedis(
|
||||
server=redis_server, username="ingestor", password="ingestor"
|
||||
)
|
||||
fake_async_redis = TestRedis(server=redis_server, username="ingestor", password="ingestor")
|
||||
fake_async_redis.connection_pool.connection_kwargs["username"] = "ingestor"
|
||||
fake_async_redis.connection_pool.connection_kwargs["password"] = "ingestor"
|
||||
|
||||
|
Reference in New Issue
Block a user