<s> from django . test import TestCase <EOL> from django . core . management import call_command , CommandError <EOL> import os <EOL> import mock <EOL> from appengine_toolkit . settings import appengine_toolkit_settings <EOL> class TestCommands ( TestCase ) : <EOL> def tearDown ( self ) : <EOL> appengine_config = os . path . join ( os . path . dirname ( appengine_toolkit_settings . APP_YAML ) , '<STR_LIT>' ) <EOL> if os . path . exists ( appengine_config ) : <EOL> os . remove ( appengine_config ) <EOL> class TestCollectDeps ( TestCommands ) : <EOL> def test_call_wrong ( self ) : <EOL> self . assertRaises ( CommandError , call_command , '<STR_LIT>' , interactive = False ) <EOL> def test_call_package ( self ) : <EOL> with mock . patch ( '<STR_LIT>' ) as mock_collect : <EOL> mock_collect . return_value = [ ] <EOL> call_command ( '<STR_LIT>' , '<STR_LIT:foo>' , interactive = False ) <EOL> self . assertEqual ( mock_collect . call_args [ <NUM_LIT:0> ] , ( '<STR_LIT:foo>' , ) ) <EOL> def test_call_req_file ( self ) : <EOL> with mock . patch ( '<STR_LIT>' ) , mock . patch ( '<STR_LIT>' ) as mock_parse , mock . patch ( '<STR_LIT>' ) as mock_collect : <EOL> mock_parse . return_value = [ '<STR_LIT:foo>' ] <EOL> mock_collect . return_value = [ ] <EOL> call_command ( '<STR_LIT>' , requirements_file = '<STR_LIT>' , interactive = False ) <EOL> def test_call_req_file_fail ( self ) : <EOL> with mock . patch ( '<STR_LIT>' ) , mock . patch ( '<STR_LIT>' ) as mock_parse : <EOL> mock_parse . return_value = [ '<STR_LIT:foo>' ] <EOL> self . assertRaises ( CommandError , call_command , '<STR_LIT>' , requirements_file = '<STR_LIT>' , interactive = False ) <EOL> def test_call_create_deps_dir ( self ) : <EOL> with mock . patch ( '<STR_LIT>' ) as mock_exists , mock . patch ( '<STR_LIT>' ) as mock_mkdir , mock . patch ( '<STR_LIT>' ) : <EOL> mock_exists . return_value = False <EOL> call_command ( '<STR_LIT>' , '<STR_LIT:foo>' , interactive = False ) <EOL> self . assertTrue ( '<STR_LIT>' in mock_mkdir . call_args [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] ) </s>
