<s> """<STR_LIT>""" <EOL> import os <EOL> import tempfile <EOL> import mox <EOL> import stubout <EOL> from google . apputils import app <EOL> from google . apputils import basetest <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT:yes>' <EOL> from simian import settings <EOL> del ( os . environ [ '<STR_LIT>' ] ) <EOL> from tests . simian import settings_test <EOL> class BaseSettingsTest ( settings_test . BaseSettingsTestBase ) : <EOL> """<STR_LIT>""" <EOL> def _GetSettingsClassUnderTest ( self ) : <EOL> return settings . BaseSettings <EOL> def testCheckValuePemX509Cert ( self ) : <EOL> """<STR_LIT>""" <EOL> pem = """<STR_LIT>""" <EOL> self . settings . CheckValuePemX509Cert ( '<STR_LIT:k>' , pem ) <EOL> def testCheckValuePemRsaPrivateKey ( self ) : <EOL> """<STR_LIT>""" <EOL> pem = """<STR_LIT>""" <EOL> self . settings . CheckValuePemRsaPrivateKey ( '<STR_LIT:k>' , pem ) <EOL> class FilesystemSettingsTest ( settings_test . BaseSettingsTestBase ) : <EOL> """<STR_LIT>""" <EOL> def _GetSettingsClassUnderTest ( self ) : <EOL> return settings . FilesystemSettings <EOL> def testGetExternalConfiguration ( self ) : <EOL> """<STR_LIT>""" <EOL> path = tempfile . mkdtemp ( ) <EOL> self . settings . _path = path <EOL> settings_filename = os . path . join ( path , '<STR_LIT>' ) <EOL> sf = open ( settings_filename , '<STR_LIT:w>' ) <EOL> sf . write ( '<STR_LIT>' ) <EOL> sf . write ( '<STR_LIT>' ) <EOL> sf . close ( ) <EOL> self . assertEqual ( '<STR_LIT:bar>' , self . settings . FOO ) <EOL> self . assertRaises ( AttributeError , getattr , self . settings , '<STR_LIT>' ) <EOL> os . unlink ( settings_filename ) <EOL> os . rmdir ( path ) <EOL> def testGetExternalConfigurationPem ( self ) : <EOL> """<STR_LIT>""" <EOL> path = tempfile . mkdtemp ( ) <EOL> self . settings . _path = path <EOL> ssl_path = os . path . join ( path , '<STR_LIT>' ) <EOL> os . mkdir ( ssl_path , <NUM_LIT:0> <NUM_LIT> ) <EOL> pem_filename = os . path . join ( ssl_path , '<STR_LIT>' ) <EOL> sf = open ( pem_filename , '<STR_LIT:w>' ) <EOL> sf . write ( '<STR_LIT:x>' ) <EOL> sf . close ( ) <EOL> self . assertEqual ( '<STR_LIT:x>' , self . settings . CA_PUBLIC_CERT_PEM ) <EOL> self . assertRaises ( ValueError , self . settings . CheckValidation ) <EOL> os . unlink ( pem_filename ) <EOL> os . rmdir ( ssl_path ) <EOL> os . rmdir ( path ) <EOL> def main ( unused_argv ) : <EOL> basetest . main ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> app . run ( ) </s>
