99import unittest
1010
1111sys .path .append ('.' )
12- from zabbix_utils .getter import Getter
12+ from zabbix_utils .getter import Getter , AgentResponse
1313from zabbix_utils .api import ZabbixAPI , APIVersion
1414from zabbix_utils .sender import ItemValue , Sender , TrapperResponse
1515from zabbix_utils .exceptions import APIRequestError , APINotSupported
@@ -160,13 +160,18 @@ def test_send_values(self):
160160 ItemValue (self .hostname , self .itemkey , 0 , 1695713666 , 100 ),
161161 ItemValue (self .hostname , self .itemkey , 5.5 , 1695713666 )
162162 ]
163- resp = list (self .sender .send (items ).values ())[0 ]
164-
163+ resp = self .sender .send (items )
165164 self .assertEqual (type (resp ), TrapperResponse , "Sending item values was going wrong" )
166165 self .assertEqual (resp .total , len (items ), "Total number of the sent values is unexpected" )
167166 self .assertEqual (resp .processed , 4 , "Number of the processed values is unexpected" )
168167 self .assertEqual (resp .failed , (resp .total - resp .processed ), "Number of the failed values is unexpected" )
169168
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+
170175
171176class CompatibilityGetTest (unittest .TestCase ):
172177 """Compatibility test with Zabbix get version 5.0"""
@@ -185,7 +190,8 @@ def test_get_values(self):
185190 resp = self .agent .get ('system.uname' )
186191
187192 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" )
189195
190196
191197if __name__ == '__main__' :
0 commit comments