This repository was archived by the owner on Sep 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "python.pythonPath" : " ${workspaceFolder}/env/bin/python"
3+ }
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ black = "^21.6b0"
4747flake8 = " ^3.9.2"
4848
4949[tool .pytest .ini_options ]
50- addopts = " -p no:warnings tests "
50+ addopts = " -p no:warnings"
5151
5252[build-system ]
5353requires = [" setuptools" , " poetry-core>=1.0.0" ]
Original file line number Diff line number Diff line change 1+ import asyncio
2+ from unittest .mock import patch
3+
4+ import pytest
5+ from _pytest .fixtures import yield_fixture
6+ from aries_cloudagent .connections .models .conn_record import ConnRecord
7+ from aries_cloudagent .core .event_bus import Event
8+ from aries_cloudagent .core .profile import Profile
9+ from asynctest import mock
10+
11+ import acapy_plugin_toolbox .connections as con
12+ import acapy_plugin_toolbox .util as util
13+
14+
15+ @pytest .mark .asyncio
16+ async def test_chandler (profile ):
17+ """Connections handler tester.
18+
19+ Runs connections_event_handler() and returns
20+ the output."""
21+ with patch .object (con , 'send_to_admins' ,
22+ mock .CoroutineMock ()) as mocked_send_to_admins :
23+ event = Event (
24+ f"acapy::record::{ ConnRecord .RECORD_TOPIC } ::{ ConnRecord .State .RESPONSE } " ,
25+ ConnRecord (state = ConnRecord .State .RESPONSE ).serialize ()
26+ )
27+
28+ await con .connections_event_handler (profile , event )
29+ mocked_send_to_admins .assert_called_once ()
30+
31+
32+ if __name__ == "__main__" :
33+ pytest .run (test_chandler ())
You can’t perform that action at this time.
0 commit comments