<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 . tools import storage <EOL> from acmd import get_tool , Server <EOL> @ urlmatch ( netloc = '<STR_LIT>' , <EOL> path = '<STR_LIT>' , <EOL> method = '<STR_LIT:POST>' ) <EOL> def mock_optimize_service ( url , request ) : <EOL> return "<STR_LIT>" <EOL> @ patch ( '<STR_LIT>' , new_callable = StringIO ) <EOL> def test_optimize_storage ( stdout ) : <EOL> with HTTMock ( mock_optimize_service ) : <EOL> tool = storage . DatastoreTool ( ) <EOL> server = Server ( '<STR_LIT:localhost>' ) <EOL> tool . execute ( server , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> eq_ ( '<STR_LIT>' , stdout . getvalue ( ) ) <EOL> @ urlmatch ( netloc = '<STR_LIT>' , <EOL> path = '<STR_LIT>' , <EOL> method = '<STR_LIT:POST>' ) <EOL> def mock_gc_service ( url , request ) : <EOL> return "<STR_LIT>" <EOL> @ patch ( '<STR_LIT>' , new_callable = StringIO ) <EOL> def test_storage_gc ( stdout ) : <EOL> with HTTMock ( mock_gc_service ) : <EOL> tool = get_tool ( '<STR_LIT>' ) <EOL> server = Server ( '<STR_LIT:localhost>' ) <EOL> tool . execute ( server , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> eq_ ( '<STR_LIT>' , stdout . getvalue ( ) ) <EOL> @ patch ( '<STR_LIT>' , new_callable = StringIO ) <EOL> @ patch ( '<STR_LIT>' , new_callable = StringIO ) <EOL> def test_print_help ( stdout , stderr ) : <EOL> tool = get_tool ( '<STR_LIT>' ) <EOL> server = Server ( '<STR_LIT:localhost>' ) <EOL> tool . execute ( server , [ '<STR_LIT>' ] ) <EOL> eq_ ( '<STR_LIT>' , stdout . getvalue ( ) ) <EOL> eq_ ( '<STR_LIT>' , stderr . getvalue ( ) . split ( '<STR_LIT:\n>' ) [ <NUM_LIT:0> ] ) </s>
