MCPcopy Create free account
hub / github.com/chatmail/core / test_bot

Function test_bot

python/tests/test_1_online.py:630–655  ·  view source on GitHub ↗

Test that bot messages can be identified as such

(acfactory, lp)

Source from the content-addressed store, hash-verified

628
629
630def test_bot(acfactory, lp):
631 """Test that bot messages can be identified as such"""
632 ac1, ac2 = acfactory.get_online_accounts(2)
633 ac1.set_config("bot", "0")
634 ac2.set_config("bot", "1")
635
636 lp.sec("ac1: create chat with ac2")
637 chat = acfactory.get_accepted_chat(ac1, ac2)
638
639 lp.sec("sending a message from ac1 to ac2")
640 text1 = "hello"
641 chat.send_text(text1)
642
643 lp.sec("wait for ac2 to receive a message")
644 msg_in = ac2._evtracker.wait_next_incoming_message()
645 assert msg_in.text == text1
646 assert not msg_in.is_bot()
647
648 lp.sec("sending a message from ac2 to ac1")
649 text2 = "reply"
650 msg_in.chat.send_text(text2)
651
652 lp.sec("wait for ac1 to receive a message")
653 msg_in = ac1._evtracker.wait_next_incoming_message()
654 assert msg_in.text == text2
655 assert msg_in.is_bot()
656
657
658def test_quote_attachment(tmp_path, acfactory, lp):

Callers

nothing calls this directly

Calls 7

secMethod · 0.80
get_online_accountsMethod · 0.45
set_configMethod · 0.45
get_accepted_chatMethod · 0.45
send_textMethod · 0.45
is_botMethod · 0.45

Tested by

no test coverage detected