<s> import os <EOL> from toscaparser . common import exception <EOL> import toscaparser . shell as shell <EOL> from toscaparser . tests . base import TestCase <EOL> from toscaparser . utils . gettextutils import _ <EOL> class ShellTest ( TestCase ) : <EOL> tosca_helloworld = os . path . join ( <EOL> os . path . dirname ( os . path . abspath ( __file__ ) ) , <EOL> "<STR_LIT>" ) <EOL> errornous_template = os . path . join ( <EOL> os . path . dirname ( os . path . abspath ( __file__ ) ) , <EOL> "<STR_LIT>" ) <EOL> def test_missing_arg ( self ) : <EOL> error = self . assertRaises ( ValueError , shell . main , '<STR_LIT>' ) <EOL> err_msg = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( err_msg , str ( error ) ) <EOL> def test_invalid_arg ( self ) : <EOL> error = self . assertRaises ( ValueError , shell . main , '<STR_LIT>' ) <EOL> err_msg = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( err_msg , str ( error ) ) <EOL> def test_template_not_exist ( self ) : <EOL> error = self . assertRaises ( <EOL> ValueError , shell . main , [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( _ ( '<STR_LIT>' ) , str ( error ) ) <EOL> def test_template_invalid ( self ) : <EOL> arg = '<STR_LIT>' + self . errornous_template <EOL> self . assertRaises ( exception . ValidationError , shell . main , [ arg ] ) <EOL> def test_template_valid ( self ) : <EOL> arg = '<STR_LIT>' + self . tosca_helloworld <EOL> try : <EOL> shell . main ( [ arg ] ) <EOL> except Exception : <EOL> self . fail ( _ ( '<STR_LIT>' ) ) </s>
