<s> import unittest <EOL> from mock import Mock , patch <EOL> import sys <EOL> from boundary . metric_list import MetricList <EOL> from io import TextIOWrapper , BytesIO <EOL> import json <EOL> import StringIO <EOL> class TestMetricList ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . metric_list = MetricList ( ) <EOL> self . text = '''<STR_LIT>''' <EOL> self . old_stdout = sys . stdout <EOL> sys . stdout = TextIOWrapper ( BytesIO ( ) , sys . stdout . encoding ) <EOL> sys . stdout = StringIO . StringIO ( ) <EOL> def tearDown ( self ) : <EOL> sys . stdout . close ( ) <EOL> sys . stdout = self . old_stdout <EOL> def test_cli_description ( self ) : <EOL> self . assertEqual ( self . metric_list . cli_description , '<STR_LIT>' ) <EOL> def test_mock_arguments ( self ) : <EOL> pass <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_execute ( self , mock_requests ) : <EOL> sys . argv = [ '<STR_LIT>' ] <EOL> self . maxDiff = None <EOL> mock_response = Mock ( ) <EOL> mock_response . status_code = <NUM_LIT:200> <EOL> mock_response . text = self . text <EOL> mock_requests . get . return_value = mock_response <EOL> self . metric_list . execute ( ) <EOL> sys . stdout . seek ( <NUM_LIT:0> ) <EOL> self . out = sys . stdout . read ( ) <EOL> json1 = json . load ( self . out ) <EOL> json2 = json . load ( self . text ) <EOL> self . assertDictEqual ( json1 , json2 ) </s>
