<s> import json <EOL> from mock import Mock <EOL> from mock import patch <EOL> from nailgun import errors <EOL> from nailgun . test . base import BaseTestCase <EOL> from nailgun . utils . zabbix import ZabbixManager <EOL> class TestZabbixManager ( BaseTestCase ) : <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_error_zabbix_request ( self , mock_urlopen ) : <EOL> urlopen_value = Mock ( ) <EOL> urlopen_value . read . return_value = json . dumps ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : '<STR_LIT:1>' , <EOL> '<STR_LIT:error>' : { <EOL> '<STR_LIT:message>' : "<STR_LIT>" , <EOL> '<STR_LIT:code>' : <NUM_LIT:1> } } ) <EOL> mock_urlopen . return_value = urlopen_value <EOL> with self . assertRaises ( errors . ZabbixRequestError ) : <EOL> ZabbixManager . _make_zabbix_request ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> { '<STR_LIT:password>' : '<STR_LIT>' , '<STR_LIT:user>' : '<STR_LIT>' } , <EOL> auth = None ) , </s>
