9
9
import unittest
10
10
11
11
sys .path .append ('.' )
12
- from zabbix_utils .getter import Getter
12
+ from zabbix_utils .getter import Getter , AgentResponse
13
13
from zabbix_utils .api import ZabbixAPI , APIVersion
14
14
from zabbix_utils .sender import ItemValue , Sender , TrapperResponse
15
15
from zabbix_utils .exceptions import APIRequestError , APINotSupported
@@ -160,13 +160,18 @@ def test_send_values(self):
160
160
ItemValue (self .hostname , self .itemkey , 0 , 1695713666 , 100 ),
161
161
ItemValue (self .hostname , self .itemkey , 5.5 , 1695713666 )
162
162
]
163
- resp = list (self .sender .send (items ).values ())[0 ]
164
-
163
+ resp = self .sender .send (items )
165
164
self .assertEqual (type (resp ), TrapperResponse , "Sending item values was going wrong" )
166
165
self .assertEqual (resp .total , len (items ), "Total number of the sent values is unexpected" )
167
166
self .assertEqual (resp .processed , 4 , "Number of the processed values is unexpected" )
168
167
self .assertEqual (resp .failed , (resp .total - resp .processed ), "Number of the failed values is unexpected" )
169
168
169
+ first_chunk = list (resp .details .values ())[0 ][0 ]
170
+ self .assertEqual (type (first_chunk ), TrapperResponse , "Sending item values was going wrong" )
171
+ self .assertEqual (first_chunk .total , len (items ), "Total number of the sent values is unexpected" )
172
+ self .assertEqual (first_chunk .processed , 4 , "Number of the processed values is unexpected" )
173
+ self .assertEqual (first_chunk .failed , (first_chunk .total - first_chunk .processed ), "Number of the failed values is unexpected" )
174
+
170
175
171
176
class CompatibilityGetTest (unittest .TestCase ):
172
177
"""Compatibility test with Zabbix get version 5.0"""
@@ -185,7 +190,8 @@ def test_get_values(self):
185
190
resp = self .agent .get ('system.uname' )
186
191
187
192
self .assertIsNotNone (resp , "Getting item values was going wrong" )
188
- self .assertEqual (type (resp ), str , "Got value is unexpected" )
193
+ self .assertEqual (type (resp ), AgentResponse , "Got value is unexpected" )
194
+ self .assertEqual (type (resp .value ), str , "Got value is unexpected" )
189
195
190
196
191
197
if __name__ == '__main__' :
0 commit comments