<s> from behave import given <EOL> from behave import then <EOL> from behave import when <EOL> from paasta_tools . cli . utils import x_mark <EOL> from paasta_tools . utils import _run <EOL> @ given ( u'<STR_LIT>' ) <EOL> @ given ( u'<STR_LIT>' ) <EOL> def given_service ( context , service_type ) : <EOL> context . service = '<STR_LIT>' % service_type <EOL> context . soa_dir = '<STR_LIT>' <EOL> @ when ( u'<STR_LIT>' ) <EOL> def run_paasta_validate ( context ) : <EOL> validate_cmd = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( context . soa_dir , context . service ) ) <EOL> context . validate_return_code , context . validate_output = _run ( command = validate_cmd ) <EOL> context . validate_output = context . validate_output . decode ( '<STR_LIT:utf-8>' ) <EOL> @ then ( u'<STR_LIT>' ) <EOL> def see_expected_return_code ( context , code ) : <EOL> print context . validate_output <EOL> print context . validate_return_code <EOL> print <EOL> assert context . validate_return_code == code <EOL> @ then ( u'<STR_LIT>' ) <EOL> def validate_status_all_pass ( context ) : <EOL> assert not context . validate_output or x_mark ( ) . decode ( '<STR_LIT:utf-8>' ) not in context . validate_output <EOL> @ then ( u'<STR_LIT>' ) <EOL> def validate_status_something_fail ( context ) : <EOL> assert x_mark ( ) . decode ( '<STR_LIT:utf-8>' ) in context . validate_output <EOL> @ then ( u'<STR_LIT>' ) <EOL> def output_contains ( context , output_string ) : <EOL> print output_string <EOL> assert output_string in context . validate_output </s>
