Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vcidst committed Sep 21, 2023
1 parent 11660bb commit 8a85a6f
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions tests/core/test_lock_store.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
import asyncio
import logging
import sys
import time
from pathlib import Path
from typing import Text
from unittest.mock import Mock, patch

import numpy as np
import pytest
import time

import rasa.core.lock_store
from _pytest.logging import LogCaptureFixture
from _pytest.monkeypatch import MonkeyPatch
from unittest.mock import patch, Mock

from rasa.core.agent import Agent
from rasa.core.channels import UserMessage
from rasa.core.constants import DEFAULT_LOCK_LIFETIME
from rasa.shared.constants import INTENT_MESSAGE_PREFIX
from rasa.core.lock import TicketLock
import rasa.core.lock_store
from rasa.core.lock_store import (
InMemoryLockStore,
LockError,
LockStore,
RedisLockStore,
DEFAULT_REDIS_LOCK_STORE_KEY_PREFIX,
)
from rasa.core.lock_store import (DEFAULT_REDIS_LOCK_STORE_KEY_PREFIX,
InMemoryLockStore, LockError, LockStore,
RedisLockStore)
from rasa.shared.constants import INTENT_MESSAGE_PREFIX
from rasa.shared.exceptions import ConnectionException
from rasa.utils.endpoints import EndpointConfig, read_endpoint_config

from typing import Text
from rasa.shared.core.domain import Domain


class FakeRedisLockStore(RedisLockStore):
"""Fake `RedisLockStore` using `fakeredis` library."""
Expand Down Expand Up @@ -389,8 +381,8 @@ async def test_redis_lock_store_with_valid_prefix(monkeypatch: MonkeyPatch):
pass


def test_tracker_store_endpoint_config_loading(endpoints_path: Text):
cfg = read_endpoint_config(endpoints_path, "tracker_store")
def test_lock_store_endpoint_config_loading(endpoints_path: Text):
cfg = read_endpoint_config(endpoints_path, endpoint_type="lock_store")

assert cfg == EndpointConfig.from_dict(
{
Expand All @@ -409,10 +401,9 @@ def test_tracker_store_endpoint_config_loading(endpoints_path: Text):
)


def test_create_lock_store_from_endpoint_config(domain: Domain, endpoints_path: Text):
def test_create_lock_store_from_endpoint_config(endpoints_path: Text):
store = read_endpoint_config(endpoints_path, "tracker_store")
tracker_store = RedisLockStore(
domain=domain,
host="localhost",
port=6379,
db=0,
Expand All @@ -425,4 +416,4 @@ def test_create_lock_store_from_endpoint_config(domain: Domain, endpoints_path:
ssl_ca_certs="my-bundle.ca-bundle",
)

assert isinstance(tracker_store, type(LockStore.create(store, domain)))
assert isinstance(tracker_store, type(LockStore.create(store)))

0 comments on commit 8a85a6f

Please sign in to comment.