This repository has been archived by the owner on Sep 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a9cd08
commit 7719803
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"python.pythonPath": "${workspaceFolder}/env/bin/python" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import asyncio | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
from _pytest.fixtures import yield_fixture | ||
from aries_cloudagent.connections.models.conn_record import ConnRecord | ||
from aries_cloudagent.core.event_bus import Event | ||
from aries_cloudagent.core.profile import Profile | ||
from asynctest import mock | ||
|
||
import acapy_plugin_toolbox.connections as con | ||
import acapy_plugin_toolbox.util as util | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_chandler(profile): | ||
"""Connections handler tester. | ||
Runs connections_event_handler() and returns | ||
the output.""" | ||
with patch.object(con, 'send_to_admins', | ||
mock.CoroutineMock()) as mocked_send_to_admins: | ||
event = Event( | ||
f"acapy::record::{ConnRecord.RECORD_TOPIC}::{ConnRecord.State.RESPONSE}", | ||
ConnRecord(state=ConnRecord.State.RESPONSE).serialize() | ||
) | ||
|
||
await con.connections_event_handler(profile, event) | ||
mocked_send_to_admins.assert_called_once() | ||
|
||
|
||
if __name__ == "__main__": | ||
pytest.run(test_chandler()) |