<s> import mock <EOL> from magnumclient import exceptions <EOL> from magnumclient . tests . v1 import shell_test_base <EOL> class ShellTest ( shell_test_base . TestCommandLineArgument ) : <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_list_success ( self , mock_list , mock_get ) : <EOL> mockbay = mock . MagicMock ( ) <EOL> mockbay . status = "<STR_LIT>" <EOL> mock_get . return_value = mockbay <EOL> self . _test_arg_success ( '<STR_LIT>' ) <EOL> self . assertTrue ( mock_list . called ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_list_failure ( self , mock_list ) : <EOL> self . _test_arg_failure ( '<STR_LIT>' , <EOL> self . _unrecognized_arg_error ) <EOL> self . assertFalse ( mock_list . called ) <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_list_failure_invalid_bay_status ( self , mock_list , mock_get ) : <EOL> mockbay = mock . MagicMock ( ) <EOL> mockbay . status = "<STR_LIT>" <EOL> mock_get . return_value = mockbay <EOL> self . assertRaises ( exceptions . InvalidAttribute , self . _test_arg_failure , <EOL> '<STR_LIT>' , self . _bay_status_error ) <EOL> self . assertFalse ( mock_list . called ) <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_create_success ( self , mock_create , mock_get ) : <EOL> mockbay = mock . MagicMock ( ) <EOL> mockbay . status = "<STR_LIT>" <EOL> mock_get . return_value = mockbay <EOL> self . _test_arg_success ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . assertTrue ( mock_create . called ) <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_create_failure_few_arg ( self , mock_create , mock_get ) : <EOL> self . _test_arg_failure ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> self . _mandatory_arg_error ) <EOL> self . assertFalse ( mock_create . called ) <EOL> self . _test_arg_failure ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> self . _mandatory_arg_error ) <EOL> self . assertFalse ( mock_create . called ) <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_create_failure_invalid_bay_status ( self , mock_create , mock_get ) : <EOL> mockbay = mock . MagicMock ( ) <EOL> mockbay . status = "<STR_LIT>" <EOL> mock_get . return_value = mockbay <EOL> self . assertRaises ( exceptions . InvalidAttribute , self . _test_arg_failure , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> self . _bay_status_error ) <EOL> self . assertFalse ( mock_create . called ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_delete_success ( self , mock_delete ) : <EOL> self . _test_arg_success ( '<STR_LIT>' ) <EOL> self . assertTrue ( mock_delete . called ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_delete_failure_no_arg ( self , mock_delete ) : <EOL> self . _test_arg_failure ( '<STR_LIT>' , self . _mandatory_arg_error ) <EOL> self . assertFalse ( mock_delete . called ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_show_success ( self , mock_show ) : <EOL> self . _test_arg_success ( '<STR_LIT>' ) <EOL> self . assertTrue ( mock_show . called ) <EOL> self . assertEqual ( <NUM_LIT:1> , mock_show . call_count ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_show_failure_no_arg ( self , mock_show ) : <EOL> self . _test_arg_failure ( '<STR_LIT>' , self . _mandatory_arg_error ) <EOL> self . assertFalse ( mock_show . called ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_update_success ( self , mock_update ) : <EOL> self . _test_arg_success ( '<STR_LIT>' ) <EOL> self . assertTrue ( mock_update . called ) <EOL> self . assertEqual ( <NUM_LIT:1> , mock_update . call_count ) <EOL> @ mock . patch ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def test_rc_update_failure_no_arg ( self , mock_update ) : <EOL> self . _test_arg_failure ( '<STR_LIT>' , self . _few_argument_error ) <EOL> self . assertFalse ( mock_update . called ) </s>
