@@ -42,7 +42,9 @@ async def test_init_args_multi_true(self):
42
42
@pytest .mark .asyncio
43
43
async def test_init_webhook_server (self ):
44
44
ac = AriesAgentController (admin_url = self .admin_url , is_multitenant = True )
45
- ac .init_webhook_server (self .webhook_host , self .webhook_port , self .webhook_base )
45
+ await ac .init_webhook_server (
46
+ self .webhook_host , self .webhook_port , self .webhook_base
47
+ )
46
48
assert type (ac .webhook_server ) == AriesWebhookServer
47
49
assert ac .webhook_server .webhook_base == self .webhook_base
48
50
assert ac .webhook_server .webhook_port == self .webhook_port
@@ -54,36 +56,33 @@ async def test_init_webhook_server(self):
54
56
async def test_init_webhook_server_args_host_type (self ):
55
57
with pytest .raises (AssertionError ):
56
58
ac = AriesAgentController (admin_url = self .admin_url , is_multitenant = True )
57
- ac .init_webhook_server (webhook_host = 1234 , webhook_port = 1234 , webhook_base = self .webhook_base )
59
+ await ac .init_webhook_server (
60
+ webhook_host = 1234 , webhook_port = 1234 , webhook_base = self .webhook_base
61
+ )
58
62
59
63
@pytest .mark .asyncio
60
64
async def test_init_webhook_server_args_host_non_empty (self ):
61
65
with pytest .raises (AssertionError ):
62
66
ac = AriesAgentController (admin_url = self .admin_url , is_multitenant = True )
63
- ac .init_webhook_server (webhook_host = "" , webhook_port = 1234 , webhook_base = self .webhook_base )
67
+ await ac .init_webhook_server (
68
+ webhook_host = "" , webhook_port = 1234 , webhook_base = self .webhook_base
69
+ )
64
70
65
71
@pytest .mark .asyncio
66
72
async def test_init_webhook_server_args_port (self ):
67
73
with pytest .raises (AssertionError ):
68
74
ac = AriesAgentController (admin_url = self .admin_url , is_multitenant = True )
69
- ac .init_webhook_server (webhook_host = "" , webhook_port = "1234" , webhook_base = self .webhook_base )
70
-
71
- @pytest .mark .asyncio
72
- async def test_listen_webhooks_error (self , caplog ):
73
- caplog .set_level (logging .WARNING )
74
- ac = AriesAgentController (admin_url = self .admin_url , is_multitenant = True )
75
- with pytest .raises (AttributeError ) as ae :
76
- await ac .listen_webhooks ()
77
- assert "Webhook server not initialised." in str (ae .value )
78
- assert "Webhook server not initialised." in caplog .text
79
- await ac .terminate ()
75
+ await ac .init_webhook_server (
76
+ webhook_host = "" , webhook_port = "1234" , webhook_base = self .webhook_base
77
+ )
80
78
81
79
@pytest .mark .asyncio
82
80
async def test_init_webhook_server_terminate (self , caplog ):
83
81
caplog .set_level (logging .INFO )
84
82
ac = AriesAgentController (admin_url = self .admin_url , is_multitenant = True )
85
- ac .init_webhook_server (self .webhook_host , self .webhook_port , self .webhook_base )
86
- await ac .listen_webhooks ()
83
+ await ac .init_webhook_server (
84
+ self .webhook_host , self .webhook_port , self .webhook_base
85
+ )
87
86
assert "Webhook server started." in caplog .text
88
87
res = await ac .webhook_server .terminate ()
89
88
assert "Webhook server terminated." in caplog .text
0 commit comments