<s> from StringIO import StringIO <EOL> from mock import patch <EOL> from httmock import urlmatch , HTTMock <EOL> from nose . tools import eq_ <EOL> from acmd import get_tool , Server <EOL> from acmd . tools import search <EOL> def test_tool_registration ( ) : <EOL> tool = get_tool ( '<STR_LIT>' ) <EOL> assert tool is not None <EOL> @ urlmatch ( netloc = '<STR_LIT>' , path = "<STR_LIT>" , query = "<STR_LIT>" ) <EOL> def service_mock ( url , request ) : <EOL> with open ( '<STR_LIT>' , '<STR_LIT:rb>' ) as f : <EOL> return f . read ( ) <EOL> EXPECTED_LIST = """<STR_LIT>""" <EOL> @ patch ( '<STR_LIT>' , new_callable = StringIO ) <EOL> def test_list_bundles ( stdout ) : <EOL> with HTTMock ( service_mock ) : <EOL> tool = get_tool ( '<STR_LIT>' ) <EOL> server = Server ( '<STR_LIT:localhost>' ) <EOL> tool . execute ( server , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> eq_ ( EXPECTED_LIST , stdout . getvalue ( ) ) </s>
