<s> import json <EOL> import mock <EOL> import unittest <EOL> import slack . http_client <EOL> from slack . exception import SlackError <EOL> class TestParseResponseClient ( unittest . TestCase ) : <EOL> def _get_mock_response ( self , response ) : <EOL> return mock . Mock ( json = lambda : json . loads ( response ) ) <EOL> def test_invalid_json ( self ) : <EOL> invalid_response = self . _get_mock_response ( '<STR_LIT>' ) <EOL> self . assertRaises ( SlackError , <EOL> slack . http_client . _parse_response , <EOL> invalid_response ) <EOL> def test_bad_response ( self ) : <EOL> bad_response = self . _get_mock_response ( <EOL> json . dumps ( { '<STR_LIT>' : False , '<STR_LIT:error>' : '<STR_LIT>' } ) ) <EOL> self . assertRaises ( SlackError , <EOL> slack . http_client . _parse_response , <EOL> bad_response ) <EOL> def test_ok_response ( self ) : <EOL> ok_response = self . _get_mock_response ( json . dumps ( { '<STR_LIT>' : True } ) ) <EOL> slack . http_client . _parse_response ( ok_response ) </s>
