mirror of
https://github.com/ivan-usov-org/bec.git
synced 2025-04-21 10:10:02 +02:00
tests(redis_connector): fixed test for messages that are not BECMessages
This commit is contained in:
parent
64fcbe37b9
commit
d42f26dad8
@ -236,19 +236,16 @@ def test_redis_connector_lrange(connector, topic, start, end, use_pipe):
|
|||||||
)
|
)
|
||||||
def test_redis_connector_set_and_publish(connector, topic, msg, pipe, expire):
|
def test_redis_connector_set_and_publish(connector, topic, msg, pipe, expire):
|
||||||
if not isinstance(msg, BECMessage):
|
if not isinstance(msg, BECMessage):
|
||||||
with pytest.raises(TypeError):
|
msg_sent = msg
|
||||||
connector.set_and_publish(topic, msg, pipe, expire)
|
|
||||||
else:
|
else:
|
||||||
connector.set_and_publish(topic, msg, pipe, expire)
|
msg_sent = MsgpackSerialization.dumps(msg)
|
||||||
|
|
||||||
connector._redis_conn.pipeline().publish.assert_called_once_with(
|
connector.set_and_publish(topic, msg, pipe, expire)
|
||||||
topic, MsgpackSerialization.dumps(msg)
|
|
||||||
)
|
connector._redis_conn.pipeline().publish.assert_called_once_with(topic, msg_sent)
|
||||||
connector._redis_conn.pipeline().set.assert_called_once_with(
|
connector._redis_conn.pipeline().set.assert_called_once_with(topic, msg_sent, ex=expire)
|
||||||
topic, MsgpackSerialization.dumps(msg), ex=expire
|
if not pipe:
|
||||||
)
|
connector._redis_conn.pipeline().execute.assert_called_once()
|
||||||
if not pipe:
|
|
||||||
connector._redis_conn.pipeline().execute.assert_called_once()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("topic, msg, expire", [["topic1", "msg1", None], ["topic2", "msg2", 400]])
|
@pytest.mark.parametrize("topic, msg, expire", [["topic1", "msg1", None], ["topic2", "msg2", 400]])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user