<s> """<STR_LIT>""" <EOL> from security_monkey . common . arn import ARN <EOL> from security_monkey . tests import SecurityMonkeyTestCase <EOL> from security_monkey import app <EOL> class ARNTestCase ( SecurityMonkeyTestCase ) : <EOL> def test_from_arn ( self ) : <EOL> proper_arns = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> for arn in proper_arns : <EOL> app . logger . info ( '<STR_LIT>' . format ( arn ) ) <EOL> arn_obj = ARN ( arn ) <EOL> self . assertFalse ( arn_obj . error ) <EOL> if "<STR_LIT:root>" in arn : <EOL> self . assertTrue ( arn_obj . root ) <EOL> else : <EOL> self . assertFalse ( arn_obj . root ) <EOL> if "<STR_LIT>" in arn : <EOL> self . assertTrue ( arn_obj . service ) <EOL> else : <EOL> self . assertFalse ( arn_obj . service ) <EOL> bad_arns = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:*>' , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" <EOL> ] <EOL> for arn in bad_arns : <EOL> app . logger . info ( '<STR_LIT>' . format ( arn ) ) <EOL> arn_obj = ARN ( arn ) <EOL> self . assertTrue ( arn_obj . error ) <EOL> def test_from_account_number ( self ) : <EOL> proper_account_numbers = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> improper_account_numbers = [ <EOL> '<STR_LIT:*>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> for accnt in proper_account_numbers : <EOL> app . logger . info ( '<STR_LIT>' . format ( accnt ) ) <EOL> arn_obj = ARN ( accnt ) <EOL> self . assertFalse ( arn_obj . error ) <EOL> for accnt in improper_account_numbers : <EOL> app . logger . info ( '<STR_LIT>' . format ( accnt ) ) <EOL> arn_obj = ARN ( accnt ) <EOL> self . assertTrue ( arn_obj . error ) <EOL> def test_extract_arns_from_statement_condition ( self ) : <EOL> test_condition_list = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> bad_condition_list = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> arn_types = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , "<STR_LIT:*>" ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT:*>' ) <EOL> ] <EOL> for condition in test_condition_list : <EOL> for arn_type in arn_types : <EOL> test_condition = { <EOL> condition : { <EOL> arn_type [ <NUM_LIT:0> ] : arn_type [ <NUM_LIT:1> ] <EOL> } <EOL> } <EOL> result = ARN . extract_arns_from_statement_condition ( test_condition ) <EOL> self . assertIsInstance ( result , list ) <EOL> self . assertTrue ( len ( result ) > <NUM_LIT:0> ) <EOL> for condition in bad_condition_list : <EOL> for arn_type in arn_types : <EOL> test_condition = { <EOL> condition : { <EOL> arn_type [ <NUM_LIT:0> ] : arn_type [ <NUM_LIT:1> ] <EOL> } <EOL> } <EOL> result = ARN . extract_arns_from_statement_condition ( test_condition ) <EOL> self . assertIsInstance ( result , list ) <EOL> self . assertTrue ( len ( result ) == <NUM_LIT:0> ) </s>
